<template>
  <div id="xia_app" @click="noOperationPrompt" :style="{ height: sizeObj.height + 'px' }">
    <div class="tab_bar">
      <div class="tab_bar_left">
        博富-{{ loginInfo?.bh }}
        <span>
          {{ huilvObj[bizhong]?.name }} 权益：{{ filersZiji["权益"] }}，可用资金：{{
            filersZiji["可用资金"]
          }}，资金使用率：{{ filersZiji["资金使用率"] }}%
        </span>
      </div>
      <div class="tab_bar_right">
        <i class="iconfonMy icon-shezhi" @click="changeLeftTap(!isShowLeft)"></i>
        <i class="iconfonMy icon-a-tubiaozhediexiangxia" @click="minWin"></i>
      </div>
    </div>
    <div class="xiad_body" :style="{ height: sizeObj.height - 35 + 'px' }">
      <div class="xiad_body_left" v-show="isShowLeft">
        <div class="body_yiji yiji_firsrt">
          <div class="yiji_title">
            <span class="yiji_zhedie" v-show="isoneMore" @click="isoneMore = !isoneMore">-</span>
            <span class="yiji_zhedie" v-show="!isoneMore" @click="isoneMore = !isoneMore">+</span>
            <span class="jibie_item"><span :class="{ active: selectMulu == -1 }">下单板</span></span>
          </div>
          <div class="yiji_childer" v-show="isoneMore">
            <div class="jibie_item erji_title" @click="selectMuluTap(0)">
              <span :class="{ active: selectMulu == 0 }">三键下单</span>
            </div>
            <div class="jibie_item erji_title" @click="selectMuluTap(1)">
              <span :class="{ active: selectMulu == 1 }">传统下单</span>
            </div>
            <div class="jibie_item erji_title" @click="selectMuluTap(12)">
              <span :class="{ active: selectMulu == 12 }">跟随下单</span>
            </div>
            <div class="jibie_item erji_title" @click="selectMuluTap(114)">
              <span :class="{ active: selectMulu == 114 }">历史交易</span>
            </div>
          </div>
        </div>
        <div class="body_yiji">
          <div class="yiji_title">
            <span class="yiji_zhedie" v-show="istwoMore" @click="istwoMore = !istwoMore">-</span>
            <span class="yiji_zhedie" v-show="!istwoMore" @click="istwoMore = !istwoMore">+</span>
            <span class="jibie_item">
              <span :class="{ active: selectMulu == 2 }">参数设置</span>
            </span>
          </div>
          <div class="yiji_childer" v-show="istwoMore">
            <div class="jibie_item erji_title" @click="selectMuluTap(3)">
              <span :class="{ active: selectMulu == 3 }">选项设置</span>
            </div>
            <div class="jibie_item erji_title" @click="selectMuluTap(4)">
              <span :class="{ active: selectMulu == 4 }">默认手数</span>
            </div>
            <!-- <div class="jibie_item erji_title" @click="selectMuluTap(5)">
              <span :class="{ active: selectMulu == 5 }">超价参数</span>
            </div>
            <div class="jibie_item erji_title" @click="selectMuluTap(6)">
              <span :class="{ active: selectMulu == 6 }">追价参数</span>
            </div> -->
            <!-- <div class="jibie_item erji_title" @click="selectMuluTap(7)">
              <span :class="{ active: selectMulu == 7 }">止损参数</span>
            </div> -->
            <!-- <div class="jibie_item erji_title" @click="selectMuluTap(8)">
              <span :class="{ active: selectMulu == 8 }">条件单参数</span>
            </div> -->
            <!-- <div class="jibie_item erji_title" @click="selectMuluTap(9)">
              <span :class="{ active: selectMulu == 9 }">炒单热键</span>
            </div> -->
            <!-- <div class="jibie_item erji_title" @click="selectMuluTap(10)">
              <span :class="{ active: selectMulu == 10 }">交易安全</span>
            </div> -->
            <div class="jibie_item erji_title" @click="openZiJin">
              <span :class="{ active: selectMulu == 115 }">银期转账</span>
            </div>
            <div class="jibie_item erji_title" @click="selectMuluTap(13)">
              <span :class="{ active: selectMulu == 13 }">密码修改</span>
            </div>
          </div>
        </div>
      </div>
      <div style="height:100%;display:flex;align-items:center;">
        <div class="left_zhedie_btn" @click="changeLeftTap">
          <i class="iconfonMy icon-xiajiantou" v-show="isShowLeft"></i>
          <i class="iconfonMy icon-xiajiantou icon" v-show="!isShowLeft"></i>
        </div>
      </div>
      <div class="body_right" v-show="showRight == 0 || showRight == 1 || showRight == 12"
        :style="{ width: !isShowLeft ? '100%' : 'calc(100% - 149px)' }">
        <!-- 三键下单 -->
        <div class="body_right_left" v-show="showRight == 0">
          <div class="body_right_left_top">
            <div class="body_right_left_title">
              <div class="hexue">
                <div class="s_cont">
                  <i class="iconfonMy icon-24gl-lock2" title="锁定" v-show="suoPrice" @click="suoPriceTap(false)"></i>
                  <i class="iconfonMy icon-24gl-unlock4" title="非锁定" v-show="!suoPrice" @click="suoPriceTap(true)"></i>
                </div>
                <div class="s_cont">
                  <!-- <input type="text" v-model="shangpinInfo.heyueBh" :disabled="suoPrice"
                                        @input="inputShangpinInfo"><i class="iconfonMy icon-sousuo sou_suo"
                                        @click="openHeyueListTap"></i> -->
                  <select :disabled="suoPrice" v-model="shangpinInfo.heyueBh" @change="inputShangpinInfo">
                    <option :value="item.heyue_bh" v-for="item in classHeyue" :key="item.hb_id">
                      {{ item.heyue_name }}
                    </option>
                  </select>
                </div>
              </div>
              <div class="shoushu">
                <div class="s_cont">
                  手数
                  <i class="iconfonMy icon-zhuanhuan" @click="shangpinInfo.reservNum = 1"></i>
                </div>
                <div class="s_cont">
                  <input type="number" v-model="shangpinInfo.reservNum"
                    oninput="this.value = this.value.replace(/[^0-9]/g, '')" />
                </div>
              </div>
              <div class="jiage">
                <div class="s_cont" @mouseleave="isSelectPrice = false">
                  <span class="jiage_s_cont" @click="isSelectPrice = !isSelectPrice">
                    价格
                    <i>...</i>
                  </span>
                  <div class="jiage_caozuo" v-show="isSelectPrice">
                    <span @click="kuaijiejiaTap('对手价')">对手价</span>
                    <span @click="kuaijiejiaTap('市价')">市价</span>
                    <span @click="kuaijiejiaTap('最新价')">最新价</span>
                  </div>
                </div>
                <div class="s_cont">
                  <input type="number" v-model="shangpinInfo.xiadanPrice" :step="bodongVal" min="0"
                    @focus="showkuaijiejia = false" oninput="this.value = Math.abs(this.value)" />
                  <div class="s_price" v-show="showkuaijiejia" @dblclick="showkuaijiejia = false">
                    {{ kuaijiejia }}
                  </div>
                </div>
              </div>
              <div class="heyue_ianhao">
                {{ shangpinInfo.heyueBh }}
              </div>
              <div class="max_min_price">
                <div style="color: #f03f8c">{{ shangpinInfo?.buy1 }}</div>
                <div style="color: #44ac90">{{ shangpinInfo?.seller1 }}</div>
              </div>
            </div>

            <div class="body_right_left_mp">
              <div class="mp_item" @click="buyShop(1)">
                <div class="red">{{ getPrice(1) }}</div>
                <div class="red">买入</div>
              </div>
              <div class="mp_item" @click="buyShop(2)">
                <div class="green">{{ getPrice(2) }}</div>
                <div class="green">卖出</div>
              </div>
              <div class="mp_item" @click="buyShop(3)">
                <div>{{ pingName }}</div>
                <div class="blue">平仓</div>
              </div>
              <div class="max_num" v-show="isMaxNumShow">
                <span @click="tianruNum(1)">&lt;={{ maxNum(filersZiji["可用资金"]) }}</span>
                <span @click="tianruNum(1)">&lt;={{ MaxNumVal }}</span>
              </div>
            </div>

            <div class="body_right_left_btn">
              <span @click="xiandanBtnTap('全部撤单')">全部撤单</span>
              <!-- <span>对价跟</span>
              <span>排队跟</span>
              <span>连续追</span> -->
            </div>
            <div class="he_yue_info" v-if="shangpinInfo?.heyue_id">合约：{{ shangpinInfo?.heyue_name }} 保证金：{{
              getBaozhengjin }} </div>
          </div>

          <div class="body_right_left_center">
            <div class="introduce">
              <!-- 300股指 点值 -->
            </div>
            <div class="inp_frame" :style="{ height: sizeObj.height - 290 + 'px' }"></div>
          </div>
          <div class="body_right_left_buttom">
            <span @click="openSunYing">止盈止损开仓</span>
            <span @click="selectMuluTap(11)">自动止盈止损</span>
            <span @click="openConditionList">添加条件单</span>
            <span
              @click="ipcRenderer.send('open-huaxiadanOption', { configInfo: JSON.stringify(storeMain.ConfigJsInfo) })">画线下单</span>
            <!-- <span @click="openZiJin">出入金</span> -->
            <i class="iconfonMy icon-a-tubiaozhediexiangxia"></i>
          </div>
        </div>

        <div class="body_right_left" v-show="showRight == 12">
          <div class="paiahng_bang">
            <div class="item_list">
              <span>用户</span>
              <input type="text" v-model="gendanForm['用户编号']" />
            </div>
            <div class="item_list">
              <span>合约</span>
              <select v-model="gendanForm['合约ID']">
                <option value="0">全部合约</option>
                <option :value="item.heyue_id" v-for="item in storeMain?.heyueinfo" :key="item.heyue_id">
                  {{ item.heyue_name }}
                </option>
              </select>
            </div>
            <div class="item_list">
              <span>数量类别</span>
              <div>
                <div class="g_radio">
                  <input type="radio" id="beishu1" value="0" v-model="gendanForm['数量类别']" />
                  <label for="beishu1">倍数</label>
                </div>
                <div class="g_radio">
                  <input type="radio" id="beishu2" value="1" v-model="gendanForm['数量类别']" />
                  <label for="beishu2">手数</label>
                </div>
              </div>
            </div>
            <div class="item_list">
              <span>倍数/手数</span>
              <input type="number" v-model="gendanForm['数量']" />
            </div>
            <div class="item_list">
              <span>跟单类别</span>
              <div>
                <div class="g_radio">
                  <input type="radio" id="gendanleibie1" value="0" v-model="gendanForm['跟单类别']" />
                  <label for="gendanleibie1">正向跟单</label>
                </div>
                <div class="g_radio">
                  <input type="radio" id="gendanleibie1" value="1" v-model="gendanForm['跟单类别']" />
                  <label for="gendanleibie1">反向跟单</label>
                </div>
              </div>
            </div>
            <div class="item_list">
              <span>跟操作</span>
              <select v-model="gendanForm['操作类别']">
                <option value="0">全部操作</option>
                <option value="15">开仓操作</option>
                <option value="17">平仓操作</option>
              </select>
            </div>
            <div class="gen_btn">
              <span @click="sumbitGendan">跟单</span>
            </div>
          </div>
        </div>
        <!-- 传统下单 -->
        <div class="body_right_left" v-show="showRight == 1">
          <div class="body_right_left_top body_right_left_top2">
            <div class="body_right_left_title body_right_left_title2">
              <div class="right_left_title_item">
                <div class="title">
                  <i class="iconfonMy icon-24gl-lock2" title="锁定" v-show="suoPrice" @click="suoPriceTap(false)"></i>
                  <i class="iconfonMy icon-24gl-unlock4" title="非锁定" v-show="!suoPrice" @click="suoPriceTap(true)"></i>
                </div>
                <div class="s_cont">
                  <select :disabled="suoPrice" v-model="shangpinInfo.heyueBh" @change="inputShangpinInfo">
                    <option :value="item.heyue_bh" v-for="item in classHeyue" :key="item.hb_id">
                      {{ item.heyue_name }}
                    </option>
                  </select>
                </div>
                <!-- <input type="text"> -->
                <!-- <i class="iconfonMy icon-sousuo sou_suo"></i> -->
              </div>
              <div class="right_left_title_item">
                <div class="title"></div>
                <div class="mai_mai_btn">
                  <span :class="{ active: chuanTongInfo.sellBuy == 1 }" @click="chuanTongInfo.sellBuy = 1">买</span>
                  <span :class="{ active: chuanTongInfo.sellBuy == 2 }" @click="chuanTongInfo.sellBuy = 2">卖</span>
                </div>
                <!-- <div class="bao_zhi">
                  <input type="checkbox" name="" id="bz" />
                  <label for="bz">保值</label>
                </div> -->
              </div>
              <div class="right_left_title_item">
                <div class="title"></div>
                <div class="PING_C">
                  <span :class="{ active: chuanTongInfo.kaiPing == 1 }" @click="chuanTongInfo.kaiPing = 1">开仓</span>
                  <span :class="{ active: chuanTongInfo.kaiPing == 3 }" @click="chuanTongInfo.kaiPing = 3">平仓</span>
                  <!-- <span>平今</span> -->
                </div>
              </div>
              <div class="right_left_title_item">
                <div class="title">手数</div>
                <div class="shou_shu">
                  <input type="number" v-model="chuanTongInfo.num" min="0" step="1" />
                  <span class="jia_jian" @click="jianNum">-</span>
                  <span class="jia_jian" @click="chuanTongInfo.num++">+</span>
                  <span class="number" v-if="chuanTongInfo.kaiPing == 1" @click="tianruNum(2)">&lt;={{ MaxNumVal }}</span>
                </div>
              </div>
              <div class="right_left_title_item">
                <div class="title">
                  <i class="iconfonMy icon-duankailianjie" title="指定价" v-show="selectPrice == 1"></i>
                  <i class="iconfonMy icon-lianjie" title="跟盘价" v-show="selectPrice == 2"></i>
                </div>
                <div class="jaige_input">
                  <input type="number" v-model="chuanTongInfo.price" min="0" step="1" />
                  <span class="jia_jian" @click="cTPrice(1)">-</span>
                  <span class="jia_jian" @click="cTPrice(2)">+</span>
                </div>
                <div style="display: flex; align-items: center; position: relative" @mouseleave="isViewList = false">
                  <!-- <div class="open_view_list" @click="isViewList = !isViewList">
                    ...
                  </div> -->
                  <div>{{ chuanTongInfo.sellBuy == 1 ? '买' : '卖' }}价</div>
                  <!-- <div class="view_list" v-if="isViewList">
                    <span>113</span>
                    <span>113</span>
                    <span>113</span>
                    <span>113</span>
                    <span>113</span>
                  </div> -->
                </div>
              </div>
              <div class="right_left_title_item">
                <div class="title"></div>
                <div class="xiadan_btn">
                  <span @click="cTbuyShop">下单（{{ chuanTongInfo.sellBuy == 1 ? '买' : '卖' }}{{ chuanTongInfo.kaiPing == 1 ?
                    '开' : '平' }}仓）</span>
                  <span @click="huifuChuanTOng">复位</span>
                </div>
              </div>
              <div class="zhang_die">
                <span class="z_z">涨板 <i>{{ shangpinInfo?.buy1 }}</i></span>
                <span class="d_d">跌板 <i>{{ shangpinInfo?.seller1 }}</i></span>
              </div>
            </div>
          </div>

          <div class="body_right_left_center">
            <div class="introduce" v-if="shangpinInfo?.heyue_id">合约：{{ shangpinInfo?.heyue_name }} 保证金：{{
              getBaozhengjin }}</div>
            <div class="introduce" v-else>
              <!-- 300股指 点值 -->
            </div>
            <div class="inp_frame inp_frame2" :style="{ height: sizeObj.height - 303 + 'px' }"></div>
          </div>
          <div class="body_right_left_buttom">
            <span @click="openSunYing">止盈止损开仓</span>
            <span @click="selectMuluTap(11)">自动止盈止损</span>
            <span @click="openConditionList">添加条件单</span>
            <span
              @click="ipcRenderer.send('open-huaxiadanOption', { configInfo: JSON.stringify(storeMain.ConfigJsInfo) })">画线下单</span>
            <!-- <span>画线下单</span> -->
            <!-- <span @click="openZiJin">出入金</span> -->
            <i class="iconfonMy icon-a-tubiaozhediexiangxia"></i>
          </div>
        </div>

        <div class="body_right_right">
          <div class="body_right_right_table">
            <span :class="{ active: activeList == '持仓汇总' }" @click="switchList('持仓汇总')">持仓汇总</span>
            <span :class="{ active: activeList == '持仓' }" @click="switchList('持仓')">持仓</span>
            <span :class="{ active: activeList == '委托' }" @click="switchList('委托')">委托</span>
            <span :class="{ active: activeList == '成交' }" @click="switchList('成交')">成交</span>
            <span :class="{ active: activeList == '跟单' }" @click="switchList('跟单')">跟单</span>
            <span :class="{ active: activeList == '排行榜' }" @click="switchList('排行榜')">排行榜</span>

            <!-- <span :class="{ active: activeList == '预备单' }" @click="switchList('预备单')">预备单</span> -->
            <span :class="{ active: activeList == '条件单' }" @click="switchList('条件单')">条件单</span>
            <span :class="{ active: activeList == '损盈单' }" @click="switchList('损盈单')">止盈止损单</span>
            <span :class="{ active: activeList == '公告表' }" @click="switchList('公告表')">公告表</span>
            <!-- <span :class="{ active: activeList == '权益图' }" @click="switchList('权益图')">权益图</span> -->

            <span :class="{ active: activeList == '资金表' }" @click="switchList('资金表')">资金表</span>
            <span :class="{ active: activeList == '合约表' }" @click="switchList('合约表')">合约表</span>
            <!-- <span :class="{ active: activeList == '期权持仓表' }" @click="switchList('期权持仓表')">期权持仓表</span> -->
            <!-- <span :class="{ active: activeList == '期权行权' }" @click="switchList('期权行权')">期权行权</span> -->
          </div>
          <div v-show="activeList == '持仓' || activeList == '委托' || activeList == '持仓汇总'">
            <el-table v-show="activeList == '持仓汇总'" :data="huiZongChicangList" ref="chicangHuizongRef" style="
                border: 1px solid #979ba2;
                box-shadow: 0 0 1px 1px #c0c2c6;
              " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
              :height="(sizeObj.height - 105) * 0.53" :row-class-name="tableRowClassName"
              @row-click="chicangHandleRowClick" @row-dblclick="chiCangdbClick" size="small" border>
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称" width="95"></el-table-column>
              <el-table-column show-overflow-tooltip label="买卖" width="40">
                <template #default="scope">
                  <div
                    :style="{ color: scope.row['买卖'] == 1 ? 'red' : 'green', 'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px' }">
                    {{ scope.row["买卖"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="持仓量" label="持仓量" width="55"></el-table-column>
              <el-table-column show-overflow-tooltip prop="可平量" label="可平量" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip width="61" label="开仓均价">
                <template #default="scope">
                  <div>
                    {{ parseFloat(Number(scope.row["持仓均价"]).toFixed(4)) }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="浮动盈亏" width="90" label="浮动盈亏">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['浮动盈亏'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["浮动盈亏"] }}
                  </div>
                </template>
              </el-table-column>

              <el-table-column show-overflow-tooltip prop="币种" label="币种" width="55">
                <template #default="scope">
                  <div>{{ huilvObj[scope.row["币种"]]?.name }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="手续费" label="手续费" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="保证金" label="保证金" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="资金占比" label="资金占比" width="60">
                <template #default="scope">
                  <div> {{ scope.row["资金占比"] }}%</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="盈利价差" width="60" label="盈利价差">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['盈利价差'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["盈利价差"] }}
                  </div>
                </template></el-table-column>
              <el-table-column show-overflow-tooltip prop="逐笔浮盈" width="90" label="逐笔浮盈">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['逐笔浮盈'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["逐笔浮盈"] }}
                  </div>
                </template></el-table-column>
              <el-table-column show-overflow-tooltip prop="浮盈比例" width="90" label="浮盈比例">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['浮盈比例'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["浮盈比例"] }}%
                  </div>
                </template></el-table-column>
              <el-table-column show-overflow-tooltip></el-table-column>
            </el-table>
            <el-table v-if="activeList == '持仓'" :data="newChicangList" ref="singleTableRef" style="
                width: 755px;
                border: 1px solid #979ba2;
                box-shadow: 0 0 1px 1px #c0c2c6;
              " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
              :height="(sizeObj.height - 105) * 0.53" :row-class-name="tableRowClassName"
              @row-click="chicangHandleRowClick" @row-dblclick="chiCangdbClick" size="small" border>
              <!-- <el-table-column show-overflow-tooltip prop="合约ID" label="合约ID" width="70"></el-table-column> -->
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称" width="95"></el-table-column>
              <el-table-column show-overflow-tooltip label="买卖" width="40">
                <template #default="scope">
                  <div
                    :style="{ color: scope.row['买卖'] == 1 ? 'red' : 'green', 'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px' }">
                    {{ scope.row["买卖"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="持仓量" label="持仓量" width="55"></el-table-column>
              <el-table-column show-overflow-tooltip prop="可平量" label="可平量" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip width="61" label="持仓价">
                <template #default="scope">
                  <div>
                    {{ parseFloat(Number(scope.row["持仓均价"]).toFixed(4)) }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="浮动盈亏" width="90" label="浮动盈亏">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['浮动盈亏'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["浮动盈亏"] }}
                  </div>
                </template>
              </el-table-column>
              <!-- <el-table-column show-overflow-tooltip prop="浮动盈亏(USD)" width="90" label="浮动盈亏(USD)">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['浮动盈亏(USD)'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["浮动盈亏(USD)"] }}
                  </div>
                </template></el-table-column> -->

              <el-table-column show-overflow-tooltip prop="币种" label="币种" width="55">
                <template #default="scope">
                  <div>{{ huilvObj[scope.row["币种"]]?.name }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="手续费" label="手续费" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="保证金" label="保证金" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="资金占比" label="资金占比" width="60">
                <template #default="scope">
                  <div> {{ scope.row["资金占比"] }}%</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="盈利价差" width="60" label="盈利价差">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['盈利价差'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["盈利价差"] }}
                  </div>
                </template></el-table-column>
              <el-table-column show-overflow-tooltip prop="逐笔浮盈" width="90" label="逐笔浮盈">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['逐笔浮盈'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["逐笔浮盈"] }}
                  </div>
                </template></el-table-column>
              <el-table-column show-overflow-tooltip prop="浮盈比例" width="90" label="浮盈比例">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['浮盈比例'] > 0 ? 'red' : 'green',
                  }">
                    {{ scope.row["浮盈比例"] }}%
                  </div>
                </template></el-table-column>
              <el-table-column show-overflow-tooltip></el-table-column>

              <!-- <el-table-column show-overflow-tooltip prop="止盈价位" label="止盈价位" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="止损价位" label="止损价位" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="止盈金额" label="止盈金额" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="止损金额" label="止损金额" width="60"></el-table-column> -->
            </el-table>
            <div class="body_right_right_btn" v-show="activeList == '持仓' || activeList == '持仓汇总'">
              <span @click="pingAll('平33')">平33%</span>
              <span @click="pingAll('平50')">平50%</span>
              <span @click="pingAll('平100')">平100%</span>
              <span @click="pingAll('反手')">快捷反手</span>
              <span @click="pingAll('损盈')">止盈止损</span>
              <span @click="pingAll('锁仓')">快捷锁仓</span>
            </div>
            <el-table :data="weituoList" style="
                width: 755px;
                border: 1px solid #979ba2;
                box-shadow: 0 0 1px 1px #c0c2c6;
              " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
              :height="activeList == '持仓' || activeList == '持仓汇总' ? (sizeObj.height - 105) * 0.47 : sizeObj.height - 75"
              size="small" border>
              <el-table-column show-overflow-tooltip label="委托时间" width="95">
                <template #default="scope">
                  <div>
                    {{
                      moment(scope.row["报单时间"] * 1000).format("HH:mm:ss")
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称" width="95"></el-table-column>
              <!-- <el-table-column show-overflow-tooltip prop="报单编号" label="报单编号"></el-table-column> -->
              <el-table-column show-overflow-tooltip prop="报单手数" label="委托数量"></el-table-column>
              <el-table-column show-overflow-tooltip label="已成交">
                <template #default="scope">
                  <div>
                    {{ scope.row["报单手数"] - scope.row["未成交手数"] }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="委托价" width="70">
                <template #default="scope">
                  <div>
                    {{
                      Number(scope.row["报单价格"]) == 0
                      ? "市价"
                      : Number(scope.row["报单价格"])
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="成交均价" width="70">
                <template #default="scope">
                  <div>{{ Number(scope.row["成交均价"]) == 0 ? '市价' : Number(scope.row["成交均价"]) }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="买卖" width="47">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['买卖方向'] == 1 ? 'red' : 'green',
                    'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px'
                  }">
                    {{ scope.row["买卖方向"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="开平" width="47">
                <template #default="scope">
                  <div>{{ scope.row["开平"] == 1 ? "开" : "平" }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="状态">
                <template #default="scope">
                  <div>
                    {{ scope.row['状态'] == '未成交还在队列中' ? '未成交' : scope.row['状态'] }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="可撤">
                <template #default="scope">
                  <div v-if="scope.row['状态'] == '未成交还在队列中'">
                    <span class="wei_tuo_che" @click="xiandanBtnTap('委托撤', scope.row)">撤单</span>
                  </div>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div v-show="activeList == '成交'">
            <el-table :data="chengjiaoList" style="
                border: 1px solid #979ba2;
                box-shadow: 0 0 1px 1px #c0c2c6;
              " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
              :height="sizeObj.height - 75" size="small" border>
              <!-- <el-table-column show-overflow-tooltip prop="ID" label="ID" width="56"></el-table-column> -->
              <el-table-column show-overflow-tooltip label="成交时间" width="95">
                <template #default="scope">
                  <div>
                    {{
                      moment(scope.row["成交时间"] * 1000).format("HH:mm:ss")
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称" width="95"></el-table-column>
              <el-table-column show-overflow-tooltip prop="成交编号" label="成交编号" width="70"></el-table-column>
              <el-table-column show-overflow-tooltip label="买卖" width="36">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['买卖方向'] == 1 ? 'red' : 'green',
                    'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px'
                  }">
                    {{ scope.row["买卖方向"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="开平" width="36">
                <template #default="scope">
                  <div :style="{ color: scope.row['开平'] == 1 ? 'red' : 'blue' }">
                    {{ scope.row["开平"] == 1 ? "开" : "平" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="成交均价" width="60">
                <template #default="scope">
                  <div>{{ Number(scope.row["成交均价"]) == 0 ? '市价' : Number(scope.row["成交均价"]) }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="成交手数" label="成交手数" width="70"></el-table-column>
              <el-table-column show-overflow-tooltip label="建仓均价" width="70">
                <template #default="scope">
                  <div>
                    {{
                      Number(scope.row["建仓均价"]) == 0
                      ? "市价"
                      : Number(scope.row["建仓均价"])
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="盈亏" width="60">
                <template #default="scope">
                  <div>{{ Number(scope.row["盈亏"]) }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="币种" width="61">
                <template #default="scope">
                  <div>{{ huilvObj[scope.row["币种"]]?.name }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="手续费" label="手续费" width="60"></el-table-column>
              <el-table-column show-overflow-tooltip prop="" label=""></el-table-column>
            </el-table>
          </div>
          <div v-show="activeList == '跟单'">
            <el-table :data="gendanList" style="
                width: 755px;
                border: 1px solid #979ba2;
                box-shadow: 0 0 1px 1px #c0c2c6;
              " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
              :height="sizeObj.height - 75" size="small" border>
              <el-table-column show-overflow-tooltip prop="跟单ID号" label="跟单ID号"></el-table-column>
              <el-table-column show-overflow-tooltip prop="用户ID" label="用户ID"></el-table-column>
              <el-table-column show-overflow-tooltip prop="用户名" label="用户名"></el-table-column>
              <el-table-column show-overflow-tooltip prop="合约ID" label="合约ID"></el-table-column>
              <el-table-column show-overflow-tooltip label="操作类别">
                <template #default="scope">
                  <div>
                    {{
                      scope.row["操作类别"] == 0
                      ? "全部跟"
                      : scope.row["操作类别"] == 15
                        ? "开仓跟"
                        : "平仓跟"
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="数量" label="数量"></el-table-column>
              <el-table-column show-overflow-tooltip label="跟单类别">
                <template #default="scope">
                  <div>{{ scope.row["跟单类别"] == 0 ? "正手" : "反手" }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="跟单类别">
                <template #default="scope">
                  <div class="qu_xiao_gen_dan" @click="quxiaoGendanTap(scope.row)">
                    取消跟单
                  </div>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div v-show="activeList == '排行榜'">
            <div class="saixuan_paihang">
              <select v-model="paihangbangFrom['日期']">
                <option value="1">昨日排行</option>
                <option value="2">上周排行</option>
                <option value="3">上月排行</option>
                <option value="4">近三个月排行</option>
              </select>
              <select v-model="paihangbangFrom['币种']">
                <option value="1">人民币</option>
                <option value="3">美元</option>
              </select>
              <div>
                <input type="checkbox" v-model="paihangbangFrom['盈亏']" :checked="paihangbangFrom['盈亏']" />
                亏损排行 <span style="color:red;margin-left: 10px;">选择下方跟单用户</span>
              </div>
            </div>
            <el-table :data="paiHangBangList" style="
                width: 755px;
                border: 1px solid #979ba2;
                box-shadow: 0 0 1px 1px #c0c2c6;
              " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
              :height="sizeObj.height - 107" @row-click="paiHangBangHandleRowClick" size="small" border>
              <el-table-column show-overflow-tooltip prop="顺序" label="名次"></el-table-column>
              <el-table-column show-overflow-tooltip label="用户">
                <template #default="scope">
                  <div>{{ formatizeNmme(scope.row["用户名"]) }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="币种">
                <template #default="scope">
                  <div>{{ huilvObj[scope.row["币种"]]?.name }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="盈亏"
                :label="paihangbangFrom['盈亏'] ? '亏损' : '盈利'"></el-table-column>
              <!-- <el-table-column show-overflow-tooltip prop="在线状态" label="在线状态">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['在线状态'] == 1 ? '#00ff00' : '#909399',
                  }">
                    {{ scope.row["在线状态"] == 1 ? "在线" : "离线" }}
                  </div>
                </template>
              </el-table-column> -->
              <el-table-column show-overflow-tooltip prop="" label="" width="40"></el-table-column>
            </el-table>
          </div>
          <el-table v-show="activeList == '条件单'" :data="tiaoJianList" style="
              width: 755px;
              border: 1px solid #979ba2;
              box-shadow: 0 0 1px 1px #c0c2c6;
            " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
            :height="sizeObj.height - 75" size="small" border>
            <el-table-column show-overflow-tooltip label="委托时间" width="95">
              <template #default="scope">
                <div>
                  {{ moment(scope.row["报单时间"] * 1000).format("HH:mm:ss") }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称" width="95"></el-table-column>
            <!-- <el-table-column show-overflow-tooltip prop="报单编号" label="报单编号"></el-table-column> -->
            <el-table-column show-overflow-tooltip prop="报单手数" label="委托数量"></el-table-column>
            <el-table-column show-overflow-tooltip label="已成交">
              <template #default="scope">
                <div>{{ scope.row["报单手数"] - scope.row["未成交手数"] }}</div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="委托价" width="70">
              <template #default="scope">
                <div>
                  {{
                    Number(scope.row["报单价格"]) == 0
                    ? "市价"
                    : Number(scope.row["报单价格"])
                  }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="成交均价" width="70">
              <template #default="scope">
                <div>{{ Number(scope.row["成交均价"]) == 0 ? '市价' : Number(scope.row["成交均价"]) }}</div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="买卖" width="47">
              <template #default="scope">
                <div :style="{
                  color: scope.row['买卖方向'] == 1 ? 'red' : 'green',
                  'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px'
                }">
                  {{ scope.row["买卖方向"] == 1 ? "买" : "卖" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="开平" width="47">
              <template #default="scope">
                <div>{{ scope.row["开平"] == 1 ? "开" : "平" }}</div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="状态">
              <template #default="scope">
                <div>
                  {{ scope.row['状态'] == '未成交还在队列中' ? '未成交' : scope.row['状态'] }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="可撤">
              <template #default="scope">
                <div v-if="scope.row['状态'] == '未成交还在队列中'">
                  <span class="wei_tuo_che" @click="xiandanBtnTap('委托撤', scope.row)">撤单</span>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <el-table v-show="activeList == '损盈单'" :data="Object.values(sunyingList)" style="
              width: 755px;
              border: 1px solid #979ba2;
              box-shadow: 0 0 1px 1px #c0c2c6;
            " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
            :height="sizeObj.height - 75" size="small" border>
            <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称">
              <template #default="scope">
                <div>
                  {{ hqdata?.[scope.row["合约ID"]]?.heyue_name }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="买卖" width="40">
              <template #default="scope">
                <div
                  :style="{ color: scope.row['方向'] == 1 ? 'red' : 'green', 'text-align': scope.row['方向'] == 1 ? 'left' : 'right', 'padding-left': '5px' }">
                  {{ scope.row["方向"] == 1 ? "买" : "卖" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="数量" label="数量" width="55"></el-table-column>
            <!-- <el-table-column show-overflow-tooltip prop="可平量" label="可平量" width="55"></el-table-column> -->
            <!-- <el-table-column show-overflow-tooltip width="61" label="开仓价">
              <template #default="scope">
                <div>
                  {{ parseFloat(Number(scope.row["持仓均价"]).toFixed(4)) }}
                </div>
              </template>
            </el-table-column> -->
            <el-table-column show-overflow-tooltip prop="币种" label="币种" width="55">
              <template #default="scope">
                <div>{{ hqdata?.[scope.row["合约ID"]]?.huobi_name }}</div>
              </template>
            </el-table-column>
            <!-- <el-table-column show-overflow-tooltip prop="手续费" label="手续费" width="55"></el-table-column> -->
            <el-table-column show-overflow-tooltip prop="止盈价位" label="止盈价位"></el-table-column>
            <el-table-column show-overflow-tooltip prop="止损价位" label="止损价位"></el-table-column>
            <el-table-column show-overflow-tooltip prop="止盈金额" label="止盈金额"></el-table-column>
            <el-table-column show-overflow-tooltip prop="止损金额" label="止损金额"></el-table-column>
            <el-table-column show-overflow-tooltip label="明细/汇总" width="60">
              <template #default="scope">
                <div>
                  {{ scope.row["持仓ID"] == 0 ? '汇总' : '明细' }}
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip label="操作">
              <template #default="scope">
                <div>
                  <span style="color: #0078d7; margin-right: 10px" @click="pingAll('损盈修改', scope.row)">修改</span>
                  <span style="color: red" @click="pingAll('损盈删除', scope.row)">删除</span>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <el-table v-show="activeList == '公告表'" :data="gongGaoList" style="
              width: 755px;
              border: 1px solid #979ba2;
              box-shadow: 0 0 1px 1px #c0c2c6;
            " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
            :height="sizeObj.height - 75" @row-dblclick="openGOngGaoInfo" size="small" border>
            <el-table-column show-overflow-tooltip prop="id" label="ID"></el-table-column>

            <el-table-column show-overflow-tooltip prop="title" label="标题"></el-table-column>
            <el-table-column show-overflow-tooltip prop="content" label="公告内容"></el-table-column>
            <el-table-column show-overflow-tooltip prop="photo" label="浏览标志"></el-table-column>
            <el-table-column show-overflow-tooltip prop="" label=""></el-table-column>
          </el-table>
          <div class="body_right_zijin" v-show="activeList == '资金表'"
            :style="{ height: sizeObj.height - 75 + 'px', width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }">
            <div class="zijin_biao" style="height:100%;width: 100%;">
              <div class="li">
                <div class="left">
                  <span>银行卡号</span>
                  <span>{{ loginInfo?.bank_bh }}</span>
                </div>
                <div class="right">
                  <span>户名</span>
                  <span>{{ loginInfo?.xingming }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>币种</span>
                  <span v-if="zijinObj[bizhong]?.['币种'] == 1">人民币</span>
                  <span v-if="zijinObj[bizhong]?.['币种'] == 2">港币</span>
                  <span v-if="zijinObj[bizhong]?.['币种'] == 3">美元</span>
                </div>
                <div class="right">
                  <span>账户余额</span>
                  <span>{{ zijinObj[bizhong]?.["账户余额"] }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>冻结金额</span>
                  <span>{{ zijinObj[bizhong]?.["冻结金额"] }}</span>
                </div>
                <div class="right">
                  <span>浮动盈亏</span>
                  <span>{{ zijinObj[bizhong]?.["浮动盈亏"] }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>风险金</span>
                  <span>{{ zijinObj[bizhong]?.["风险金"] }}</span>
                </div>
                <div class="right">
                  <span>隔夜风险金</span>
                  <span>{{ zijinObj[bizhong]?.["隔夜风险金"] }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>占用保证金</span>
                  <span>{{ zijinObj[bizhong]?.["占用保证金"] }}</span>
                </div>
                <div class="right">
                  <span>上次结算准备金</span>
                  <span>{{ zijinObj[bizhong]?.["上次结算准备金"] }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>今日入金</span>
                  <span>{{ zijinObj[bizhong]?.["今日入金"] }}</span>
                </div>
                <div class="right">
                  <span>今日出金</span>
                  <span>{{ zijinObj[bizhong]?.["今日出金"] }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>今日调整</span>
                  <span>{{ zijinObj[bizhong]?.["今日调整"] }}</span>
                </div>
                <div class="right">
                  <span>今日划拨</span>
                  <span>{{ zijinObj[bizhong]?.["今日划拨"] }}</span>
                </div>
              </div>
              <div class="li">
                <div class="left">
                  <span>平仓盈亏</span>
                  <span>{{ zijinObj[bizhong]?.["平仓盈亏"] }}</span>
                </div>
                <div class="right">
                  <span>手续费</span>
                  <span>{{ zijinObj[bizhong]?.["手续费"] }}</span>
                </div>
              </div>
              <!-- <div class="zijinzhuanhuan">
                <span class="btn" @click="switchCurrency">切换币种</span>
                <div>
                  <span>{{ zhuanHuanInfo.name1 }}</span>
                  <input type="number" step="1" min="0" v-model="zhuanHuanInfo.val1" @input="heardinputZhuanhuan" />
                </div>
                <i class="iconfonMy icon-Rightxiangyou34"></i>
                <div>
                  <span>{{ zhuanHuanInfo.name2 }}</span>
                  <span class="jieguo">{{ zhuanHuanInfo.val2 }}</span>
                </div>
                <span class="btn" @click="huobiZuanHuan">交换</span>
                <span class="btn" @click="huobiZuanHuanSumbit">提交</span>
              </div> -->
            </div>
          </div>
          <el-table v-if="activeList == '合约表'" :data="heyuTable" style="
              width: 755px;
              border: 1px solid #979ba2;
              box-shadow: 0 0 1px 1px #c0c2c6;
            " :style="{ width: isShowLeft ? sizeObj.width - 530 + 'px' : sizeObj.width - 400 + 'px' }"
            @row-click="activeShop" :height="sizeObj.height - 75" size="small" border>
            <el-table-column show-overflow-tooltip prop="合约代号" label="交易代码" width="95"></el-table-column>
            <el-table-column show-overflow-tooltip prop="名称" label="合约名称"></el-table-column>
            <el-table-column show-overflow-tooltip prop="市场名称" label="市场"></el-table-column>
            <el-table-column show-overflow-tooltip prop="客户端显示币种" label="币种">
              <template #default="scope">
                <div>{{ huilvObj[scope.row["客户端显示币种"]]?.name }}</div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="客户端合约乘数" label="合约乘数"></el-table-column>
            <el-table-column show-overflow-tooltip prop="最小波动" label="最小变动价位"></el-table-column>
            <el-table-column show-overflow-tooltip prop="建仓保证金" label="保证金"></el-table-column>
            <el-table-column show-overflow-tooltip width="40"></el-table-column>
          </el-table>

        </div>
      </div>

      <div class="body_right2" v-show="showRight == 3">
        <div class="body_right2_left">
          <div class="body_right2_left_top">
            <div>
              <input type="checkbox" id="shengyin" v-model="ordercanshu.shengYin" :checked="ordercanshu.shengYin" />
              <label for="shengyin">交易声音提示</label>
            </div>
            <!-- <div>
              <input type="checkbox" id="buyOrderXY" v-model="ordercanshu.buyOrderXY" :checked="ordercanshu.buyOrderXY" />
              <label for="buyOrderXY">下单窗口位置记忆</label>
            </div> -->
            <div>
              <input type="checkbox" id="maxNumKaiClick" v-model="ordercanshu.maxNumKaiClick"
                :checked="ordercanshu.maxNumKaiClick" />
              <label for="maxNumKaiClick">点击最大可开仓手数填单</label>
            </div>
            <!-- <div>
              <input type="checkbox" id="chiCangListFenLie" v-model="ordercanshu.chiCangListFenLie"
                :checked="ordercanshu.chiCangListFenLie" />
              <label for="chiCangListFenLie">持仓列表按方向分列</label>
            </div> -->
            <div>
              <input type="checkbox" id="shuangJiCHiCnag" v-model="ordercanshu.shuangJiCHiCnag"
                :checked="ordercanshu.shuangJiCHiCnag" />
              <label for="shuangJiCHiCnag">双击持仓和挂单列表的操作确认</label>
            </div>
            <div>
              <input type="checkbox" id="maxNumClick" v-model="ordercanshu.maxNumClick"
                :checked="ordercanshu.maxNumClick" />
              <label for="maxNumClick">点击最大手数填单</label>
            </div>
          </div>
          <div class="right2_left_bottom" style="font-size:12px;">
            <div class="right2_left_bottom_div">
              <span>反手默认下单方式</span>
              <select v-model="ordercanshu.fanshouprice">
                <option value="1">市价</option>
                <option value="2">对手价</option>
                <option value="3">最新价</option>
              </select>
            </div>
            <div class="right2_left_bottom_div">
              <span>交易资金主币种显示为</span>
              <select class="right2_left_bottom_div_heyue">
                <option value="1">美元（USD）</option>
              </select>
            </div>
            <div class="right2_left_bottom_div">
              <span>比例平仓下单方式</span>
              <select v-model="ordercanshu.bilipingcangprice">
                <option value="1">市价</option>
                <option value="2">对手价</option>
                <option value="3">最新价</option>
              </select>
            </div>

            <div class="right2_left_bottom_div">
              <span>权益显示和计算采用</span>
              <select>
                <option value="1">动态权益</option>
                <!-- <option value="2">市值权益</option> -->
              </select>
            </div>
            <!-- <div class="right2_left_bottom_div">
              <span>下单板显示位置</span>
              <select>
                <option value="1">居右</option>
                <option value="2">居左</option>
              </select>
            </div> -->
          </div>
        </div>
        <div class="body_right2_right">
          <div class="right2_right_select">
            <select v-model="ordercanshu.buytype">
              <option value="1">三键下单</option>
              <!-- <option value="2">传统下单</option> -->
              <!-- <option value="2">下单工具条</option>
              <option value="2">页面下单</option>
              <option value="2">盘口下单</option>
              <option value="2">盘口炒单</option>
              <option value="2">标准套利下单</option> -->
            </select>
          </div>
          <div class="right2_right_body" v-if="ordercanshu.buytype == 1">
            <div class="right2_right_body_div">
              <span>一、委托确认</span>
              <select v-model="ordercanshu.confirmation">
                <option value="1">启用</option>
                <option value="2">不启用</option>
              </select>
            </div>
            <!-- <div class="right2_right_body_div">
              <span>说明:右键点击列表，选菜单项下单，不受确认开关控制，直接发出委托。</span>
            </div> -->
            <div class="right2_right_body_div">
              <span>二、双击持仓列表快速平仓</span>
              <select v-model="ordercanshu.doubleClickFastLiquidation">
                <option value="1">启用</option>
                <option value="2">不启用</option>
              </select>
            </div>
            <div class="right2_right_body_div">
              <span>三、合约信息显示</span>
              <select name="" id="">
                <option value="1">保证金等信息</option>
              </select>
            </div>
            <!-- <div class="right2_right_body_div right2_right_body_div45">
              <span>四、Log区显示</span>
              <select name="" id="">
                <option value="1">日志</option>
                <option value="2">盘口价格</option>
              </select>
            </div> -->
          </div>
          <div class="right2_right_body" v-if="ordercanshu.buytype == 2">
            <div class="right2_right_body_div">
              <span>一、委托确认</span>
              <select v-model="ordercanshu.confirmation2">
                <option value="1">启用</option>
                <option value="2">不启用</option>
              </select>
            </div>
            <div class="right2_right_body_div">
              <span>二、双击持仓列表快速平仓</span>
              <select v-model="ordercanshu.doubleClickFastLiquidation2">
                <option value="1">启用</option>
                <option value="2">不启用</option>
              </select>
            </div>
            <div class="right2_right_body_div">
              <span>三、合约信息显示</span>
              <select name="" id="">
                <option value="1">保证金等信息</option>
              </select>
            </div>
          </div>
        </div>
      </div>
      <div class="body_right6" v-show="showRight == 4" style="flex:1;">
        <div class="body_right6_cont" style="flex:1;">
          <div class="body_right6_title">默认下单手数</div>
          <div class="body_right6_right" style="display:flex;">
            <div>
              <el-table :data="Object.values(heyueNameList)" style="
              width: 345px;
              border: 1px solid #979ba2;
              box-shadow: 0 0 1px 1px #c0c2c6;
            " :height="sizeObj.height - 85" size="small" border>
                <el-table-column show-overflow-tooltip prop="heyue_zu_name" label="设置"></el-table-column>
                <el-table-column show-overflow-tooltip label="默认手数">
                  <template #default="scope">
                    <div><input type="number" style="width:90px" v-model="numberOfOrdersByDefault[scope.row.heyue_zu_id]"
                        placeholder="1" min="1" oninput="this.value = this.value.replace(/[^0-9]/g, '')">
                    </div>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </div>
      <div class="body_right4" v-show="showRight == 5">
        <div class="body_right4_div">
          <span>超价的基准价</span>
          <select name="" id="">
            <option value="1">排队价</option>
            <option value="1">对手价</option>
            <option value="1">最新价</option>
          </select>
        </div>
        <div class="body_right4_div">
          <span>买超价</span>
          <input type="number" />
        </div>
        <div class="body_right4_div">
          <span>卖超价</span>
          <input type="number" />
        </div>
        <div class="body_right4_div">
          <button>添加品种超价参数</button>
        </div>
        <div class="body_right4_cont">注意：</div>
        <div class="body_right4_cont">
          1、超价是在基准价的基础上增减N个最小变动价位。
        </div>
        <div class="body_right4_cont">
          2、建议买入的参数设正值，卖出的参数设负值。
        </div>
        <div class="body_right4_cont">3、添加品种超价参数，优先按此获取。</div>
      </div>
      <div class="body_right3 body_right5" v-show="showRight == 6">
        <div class="body_right3_left body_right5_left">
          <div class="body_right3_left_title">连续追价参数</div>
          <div class="right3_left_div right5_left_div">
            <label for="xiadanView">自动连续追价触发条件</label>
            <input type="number" />
            <span class="baifenhao">秒没成交</span>
          </div>
          <div class="right3_left_div right5_left_div">
            <span class="right3_left_div_span">追价价格</span>
            <select name="" id="">
              <option value="1">阶梯追价</option>
            </select>
          </div>
          <div class="right3_left_div right5_left_div">
            <span class="right3_left_div_span">追价终止</span>
            <select name="" id="">
              <option value="1">不终止</option>
            </select>
            <span class="baifenhao">报价价位</span>
          </div>
        </div>
        <div class="body_right3_right body_right5_right">
          <div class="body_right3_right_title">说明</div>
          <div class="body_right3_right_div">
            1、追价，是指在单子没有及时成交的情况下，撒掉委托，以有利于成交的价格为委托价，重新发出委托。
          </div>
          <div class="body_right3_right_div">
            2、追价价格设置为“阶梯追价”时，在对手价基础上，第一次超1个，第二次超2个，以后每次都超3个价位。
          </div>
          <div class="body_right3_right_div">
            3、追价终止中的数字表示追价下单价格偏离首次下单价格超过多少个价位即停止追价。(追价价格为市价时不受此选项控制)
          </div>
        </div>
      </div>
      <div class="body_right6" v-show="showRight == 7">
        <div class="body_right6_cont">
          <div class="body_right6_title">止损参数</div>
          <div class="body_right6_left">
            <div class="body_right6_left_div">
              <span>时效</span>
              <select name="" id="">
                <option value="1">永久有效</option>
                <option value="2">延时</option>
              </select>
            </div>
            <div class="body_right6_left_div">
              <span>开仓自动止损的基准价</span>
              <select name="" id="">
                <option value="1">第一批成交价</option>
                <option value="2">延时</option>
              </select>
            </div>
            <div class="body_right6_left_div">
              <span>默认策略</span>
              <select name="" id="">
                <option value="1">限价止损+限价止盈</option>
                <option value="2">延时</option>
              </select>
            </div>
            <div class="body_right6_left_div">
              <span>多单止损比较</span>
              <span class="sun_jia">最新价</span>
            </div>
            <div class="body_right6_left_div">
              <span>空单止损比较</span>
              <span class="sun_jia">最新价</span>
            </div>
            <div class="body_right6_left_div">
              <button>国内期货合约默认止损点差参数</button>
            </div>
          </div>
          <div class="body_right6_right">
            <div class="body_right6_right_div">
              <input type="checkbox" />
              <label for="">开仓自动止损止盈（条件单、反手、套利、期权、TAS、LME开仓除外）</label>
            </div>
            <div class="body_right6_right_div">
              <input type="checkbox" />
              <label for="">画线止损止盈默认全部持仓</label>
            </div>
            <div class="body_right6_right_div">
              <input type="checkbox" />
              <label for="">输入浮亏/浮盈百分比，生成触发价</label>
            </div>
            <div class="body_right6_right_div">
              <span class="body_right6_right_div_set_width">止损单和保本单委托价格</span>
              <span>期货</span>
              <select name="" id="">
                <option value="1">市价</option>
              </select>
              <span>期权</span>
              <select name="" id="">
                <option value="1">对手价</option>
              </select>
              <a href="//www.baidu.com">风险提示</a>
            </div>
            <div class="body_right6_right_div">
              <span class="body_right6_right_div_set_width">止盈单委托价格</span>
              <span>期货</span>
              <select name="" id="">
                <option value="1">市价</option>
              </select>
              <span>期权</span>
              <select name="" id="">
                <option value="1">对手价</option>
              </select>
            </div>
            <div class="body_right6_right_div">提示：</div>
            <div class="body_right6_right_div">
              1、修改以上属性仅对后续设置的止损单、止盈单生效。
            </div>
            <div class="body_right6_right_div">
              2、开仓自动止损在委托成交后会自动转化为损盈单，止损预备单在云端运行，软件关闭后仍然有效。
            </div>
            <div class="body_right6_right_div">
              3、损盈单不保证成交，市价、超价、对手价下单，50%的概率成交在对手价，与触发价有1个点或更多的点差。
            </div>
            <div class="body_right6_right_div">
              4、损盈单触发后，如果持仓可用数里不足，会自动撤掉原有挂单。
            </div>
          </div>
        </div>
      </div>
      <div class="body_right6" v-show="showRight == 8">
        <div class="body_right6_cont body_right7_cont">
          <div class="body_right6_title">条件单参数</div>
          <div class="body_right6_left body_right7_left">
            <div class="body_right6_left_div">
              <span class="body_right6_left_div_name">画线下单自动止盈止损</span>
              <select name="" id="">
                <option value="1">启用</option>
                <option value="2">不启用</option>
              </select>
              <span>（损、盈止损参数设置）</span>
            </div>
            <div class="body_right6_left_div">
              <span class="body_right6_left_div_name">画线下单委托价</span>
              <select name="" id="">
                <option value="1">对手价</option>
                <option value="1">超价</option>
                <option value="1">市价</option>
                <option value="1">画线价</option>
              </select>
            </div>
            <div class="body_right6_left_div">
              <span class="body_right6_left_div_name">画线下单持续性</span>
              <select name="" id="">
                <option value="1">当前交易日有效</option>
                <option value="1">永久有效</option>
              </select>
            </div>
            <div class="body_right6_left_div">
              <input type="checkbox" />
              <label>画线下单使用默认下单手数</label>
            </div>
            <div class="body_right6_left_div">
              <input type="checkbox" />
              <label>最新价上画线默认转为委托单</label>
            </div>
            <div class="body_right6_left_div">
              提醒：修改以上属性仅对后续画线下单生效。
            </div>
          </div>
          <div class="body_right6_right">
            <div class="body_right6_right_div">
              <input type="checkbox" />
              <label for="">超过100条自动删除已触发云条件单/损盈单</label>
            </div>
            <div class="body_right6_right_div" style="margin-top: 20px">
              提示：
            </div>
            <div class="body_right6_right_div">
              1、条件单不保证成交，也不保证成交在触发价，会有1个或更大的交易滑点。
            </div>
            <div class="body_right6_right_div">
              2、条件单在云端运行，软件关闭后仍然有效，云端自动确认结算单。
            </div>
            <div class="body_right6_right_div">
              3、不论是碰线还是直接越线，画线下单都会触发。
            </div>
            <div class="body_right6_right_div">
              4、条件单平仓时，如果持仓可用数里不足，会自动撤掉原有挂单。
            </div>
            <div class="body_right6_right_div" style="justify-content: space-between">
              5、上期所合约，按照设置决定是否优先平今。<a href="http://www.baidu.com" style="margin-right: 25px">条件单风险揭示</a>
            </div>
          </div>
        </div>
      </div>
      <div class="body_right7" v-show="showRight == 9">
        <div class="body_right7_left body_right8_left">
          <div class="body_right7_left_div">
            <div class="kuai_jie_jian">未设置</div>
            <div class="dong_zuo">开/关(Ctrl+键值)</div>
          </div>
        </div>
        <div class="body_right7_right">
          <div class="body_right7_right_title">注意：</div>
          <div class="body_right7_right_div">
            1、请先设置开/关键值，开启炒单后，才能使用炒单功能。
          </div>
          <div class="body_right7_right_div">
            2、当小键盘上的NumLock键锁定时小键盘上的值有效。
          </div>
          <div class="body_right7_right_div">
            3、关闭炒单后，炒单热键的键，才能用来输入。
          </div>
          <div class="body_right7_right_div">
            <span>4、同向下单时撤掉原有挂单</span><select name="" id="">
              <option value="1">是</option>
              <option value="1">否</option>
            </select>
          </div>
          <div class="body_right7_right_div">
            5、开/平/自动热键，对专用下单炫彩键盘也生效。(对外盘无效)
          </div>
          <div class="body_right7_right_div">
            <span>6、挂盈N点平仓单参数N为1</span> <input type="number" />
          </div>
          <div class="body_right7_right_div">
            7、手数++、手数-的手数为该合约的默认下单手数。
          </div>
        </div>
      </div>
      <div class="body_right8" v-show="showRight == 10">
        <div class="body_right8_div">
          <input type="checkbox" id="autoLog" />
          <label for="autoLog">自动记录操作日志</label>
        </div>
        <div class="body_right8_div">
          <input type="checkbox" id="autoLog" />
          <label for="autoLog">自动确认结算单</label>
        </div>
        <div class="body_right8_div">
          <input type="checkbox" id="autoLog" />
          <label for="autoLog">登录验证码</label>
        </div>
        <div class="body_right8_div">
          <input type="checkbox" id="autoLog" />
          <label for="autoLog">标题栏显示资金信息</label>
        </div>
        <div class="body_right8_div">
          <input type="checkbox" id="autoLog" />
          <label for="autoLog">通知消息一天只弹出一次</label>
        </div>
        <div class="body_right8_div">
          <input type="checkbox" id="autoLog" />
          <label for="autoLog">启用预期风险度提示</label>
        </div>
        <div class="body_right8_div">
          <span>风险度提醒阈值</span>
          <input type="number" class="yuzhi" />
          <span>%</span>
        </div>
      </div>
      <div class="body_right6" v-show="showRight == 11" style="flex:1;">
        <div class="body_right6_cont" style="flex:1;">
          <div class="body_right6_title">自动止盈止损参数设置</div>
          <div class="body_right6_right" style="display:flex;">
            <div>
              <el-table :data="Object.values(heyueNameList)" style="
              width: 545px;
              border: 1px solid #979ba2;
              box-shadow: 0 0 1px 1px #c0c2c6;
            " :height="sizeObj.height - 107" size="small" border>
                <el-table-column show-overflow-tooltip prop="heyue_zu_name" label="设置"></el-table-column>
                <el-table-column show-overflow-tooltip label="止盈点">
                  <template #default="scope">
                    <div><input type="number" style="width:90px" v-model="heyueying[scope.row.heyue_zu_id]"
                        placeholder="0.00">
                    </div>
                  </template>
                </el-table-column>
                <el-table-column show-overflow-tooltip label="止损点">
                  <template #default="scope">
                    <div><input type="number" style="width:90px" v-model="heyuesun[scope.row.heyue_zu_id]"
                        placeholder="0.00">
                    </div>
                  </template>
                </el-table-column>
                <el-table-column show-overflow-tooltip label="交易">
                  <template #default="scope">
                    <div style="color:#cfd0d0;font-display: flex;align-items: center;"> <input type="checkbox" disabled
                        checked>{{ scope ? "可交易" : '' }} </div>
                  </template>
                </el-table-column>
              </el-table>
              <div class="body_right6_right_div body_right_left_btn" style="padding:3px;margin-bottom: 0;">
                <span style="width:auto;padding:0 10px;" @click="sumbitYingSun">提交止盈止损设置</span>
                <span style="width:auto;padding:0 10px;" @click="sumbitYingSun(2)">取消所有止盈止损设置</span>
              </div>
            </div>
            <div style="flex:1;padding:0 10px">
              <div class="body_right6_right_div" style="color:red;">
                1、修改以上属性仅对后续设置的止损单、止盈单生效。
              </div>
              <div class="body_right6_right_div" style="color:red;">
                2、开仓自动止损在委托成交后会自动转化为损盈单，止损预备单在云端运行，软件关闭后仍然有效。
              </div>
              <div class="body_right6_right_div" style="color:red;">
                3、损盈单不保证成交，市价、超价、对手价下单，50%的概率成交在对手价，与触发价有1个点或更多的点差。
              </div>
              <div class="body_right6_right_div" style="color:red;">
                4、损盈单触发后，如果持仓可用数里不足，会自动撤掉原有挂单。
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="body_right6" v-show="showRight == 13">
        <div class="body_right6_cont pass_word_body">
          <div class="body_right6_title">密码修改</div>
          <div class="pass_word">
            <span :class="{ active: passwordfrom.type == 1 }" @click="passwordfrom.type = 1">登录密码修改</span>
            <span :class="{ active: passwordfrom.type == 2 }" @click="passwordfrom.type = 2">资金密码修改</span>
          </div>
          <div class="input_password">
            <div>
              <span>原密码：</span>
              <input type="text" v-model="passwordfrom.oldpass" />
            </div>
            <div>
              <span>新密码：</span>
              <input type="password" v-model="passwordfrom.newpass" />
            </div>
            <div>
              <span>确认密码：</span>
              <input type="password" v-model="passwordfrom.okpass" />
            </div>
          </div>
          <div class="sumbit">
            <span @click="editpassword">确认提交</span>
          </div>
        </div>
      </div>

      <div class="body_right" v-show="showRight == 114" style="flex:1">
        <div class="body_right_right">
          <div class="body_right_right_table">
            <span :class="{ active: activelishiList == '历史委托' }" @click="switchlishiList('历史委托')">历史委托</span>
            <span :class="{ active: activelishiList == '历史成交' }" @click="switchlishiList('历史成交')">历史成交</span>
            <span :class="{ active: activelishiList == '历史平仓' }" @click="switchlishiList('历史平仓')">历史平仓</span>

            <input v-model="historyTrading.time" type="datetime-local" id="datetime" name="datetime" step="1" />
            <input v-model="historyTrading.timeEnd" type="datetime-local" id="datetime" name="datetime" step="1" />
            <select v-model="historyTrading.huobiId">
              <option value="0">请选择</option>
              <option :value="item.id" v-for="item in huilvObj" :key="item.id">
                {{ item.name }}
              </option>
            </select>
          </div>
          <div v-show="activelishiList == '历史委托'">
            <el-table :data="historyTradingList.weituo" style="border: 1px solid #979ba2; box-shadow: 0 0 1px 1px #c0c2c6"
              :style="{ width: isShowLeft ? sizeObj.width - 170 + 'px' : sizeObj.width - 40 + 'px' }"
              :height="sizeObj.height - 75" size="small" border>
              <el-table-column show-overflow-tooltip label="委托时间">
                <template #default="scope">
                  <div>
                    {{
                      moment(scope.row["报单时间"] * 1000).format("HH:mm:ss")
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称"></el-table-column>
              <el-table-column show-overflow-tooltip prop="报单状态" label="状态"></el-table-column>
              <el-table-column show-overflow-tooltip label="买卖">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['买卖方向'] == 1 ? 'red' : 'green',
                    'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px'
                  }">
                    {{ scope.row["买卖方向"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="开平">
                <template #default="scope">
                  <div>{{ scope.row["开平标志"] == 1 ? "开" : "平" }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="委托价">
                <template #default="scope">
                  <div>
                    {{
                      Number(scope.row["报单价格"]) == 0
                      ? "市价"
                      : Number(scope.row["报单价格"])
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="委托类型" label="委托类型"></el-table-column>
              <el-table-column show-overflow-tooltip prop="报单数量" label="委托数量"></el-table-column>
              <el-table-column show-overflow-tooltip prop="币种" label="币种"></el-table-column>
            </el-table>
          </div>
          <div v-show="activelishiList == '历史成交'">
            <el-table :data="historyTradingList.chengjiao"
              style="border: 1px solid #979ba2; box-shadow: 0 0 1px 1px #c0c2c6"
              :style="{ width: isShowLeft ? sizeObj.width - 170 + 'px' : sizeObj.width - 40 + 'px' }"
              :height="sizeObj.height - 75" size="small" border>
              <el-table-column show-overflow-tooltip label="成交时间">
                <template #default="scope">
                  <div>
                    {{
                      moment(scope.row["成交时间戳"] * 1000).format("HH:mm:ss")
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称"></el-table-column>
              <el-table-column show-overflow-tooltip prop="成交编号" label="成交编号"></el-table-column>
              <el-table-column show-overflow-tooltip label="买卖">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['买卖方向'] == 1 ? 'red' : 'green',
                    'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px'
                  }">
                    {{ scope.row["买卖方向"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="开平">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['开平标志'] == 1 ? 'red' : 'blue',
                  }">
                    {{ scope.row["开平标志"] == 1 ? "开" : "平" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="成交均价">
                <template #default="scope">
                  <div>{{ Number(scope.row["成交价格"]) == 0 ? '市价' : Number(scope.row["成交价格"]) }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="成交数量" label="成交手数"></el-table-column>
              <el-table-column show-overflow-tooltip prop="币种" label="币种"></el-table-column>
              <el-table-column show-overflow-tooltip prop="手续费" label="手续费"></el-table-column>
            </el-table>
          </div>
          <div v-show="activelishiList == '历史平仓'">
            <el-table :data="historyTradingList.pingcang"
              style="border: 1px solid #979ba2; box-shadow: 0 0 1px 1px #c0c2c6"
              :style="{ width: isShowLeft ? sizeObj.width - 170 + 'px' : sizeObj.width - 40 + 'px' }"
              :height="sizeObj.height - 75" size="small" border>
              <el-table-column show-overflow-tooltip label="平仓时间">
                <template #default="scope">
                  <div>
                    {{
                      moment(scope.row["平仓时间戳"] * 1000).format("HH:mm:ss")
                    }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="合约名称" label="合约名称"></el-table-column>
              <el-table-column show-overflow-tooltip prop="平仓成交号" label="成交编号"></el-table-column>
              <el-table-column show-overflow-tooltip label="买卖">
                <template #default="scope">
                  <div :style="{
                    color: scope.row['买卖方向'] == 1 ? 'red' : 'green',
                    'text-align': scope.row['买卖方向'] == 1 ? 'left' : 'right', 'padding-left': '5px'
                  }">
                    {{ scope.row["买卖方向"] == 1 ? "买" : "卖" }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip label="开仓均价">
                <template #default="scope">
                  <div>{{ Number(scope.row["开仓均价"]) }}</div>
                </template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="平仓价格" label="平仓价格"></el-table-column>
              <el-table-column show-overflow-tooltip prop="平仓手数" label="平仓手数"></el-table-column>
              <el-table-column show-overflow-tooltip prop="平仓盈亏" label="平仓盈亏"></el-table-column>
              <el-table-column show-overflow-tooltip prop="币种" label="币种"></el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>
    <diao_msg ref="diaoMsg" />
  </div>
</template>

<script setup>
import { ref, onMounted, computed, watch, onUnmounted, reactive } from 'vue'
const { ipcRenderer } = require('electron');
import mqtt from 'precompiled-mqtt'
import { ElMessage, ElNotification } from 'element-plus';
import { mainStore } from '@/store/index.js'
import { throttle } from 'lodash';
import moment from 'moment'
import axios from 'axios'
const CryptoJS = require('crypto-js');
import logHandler from '@/utils/logHandler.js'
import { playAudio } from '@/components/view_list/utils/playmusice.js'
import tiaoJianTxt from '@/utils/tiaojiandan.js'
import diao_msg from './diao_msg.vue'


const pingName = computed(() => {
  let active = chicangActive.value
  if (active) {
    let name = '市价'
    if (ordercanshu.bilipingcangprice == 2) {
      name = '对手价'
    }
    if (ordercanshu.bilipingcangprice == 3) {
      name = '最新价'
    }
    return name
  } else {
    return '先开先平'
  }
})

const bodongVal = computed(() => {
  if (heyueData.value.length > 0 && shangpinInfo.value.heyueBh) {
    let hy = heyueData.value,
      SPI = shangpinInfo.value;
    return hy[hy.findIndex((item) => item["合约代号"] == SPI.heyueBh)][
      "最小波动"
    ];
  }
  return 0;
});

const heyueNameList = computed(() => {
  let obj = {}
  Object.values(storeMain?.classHeyue['期货']).forEach(item => {
    obj[item.heyue_zu_name] = item
  })
  return obj;
});

const classHeyue = computed(() => {
  let arr = Object.values(storeMain?.classHeyue['期货']).filter(item => {
    return item.zhu_bz == 1
  })
  return arr;
});

const getBaozhengjin = computed(() => {
  return hyData.value[shangpinInfo.value?.heyue_id]["建仓保证金"];
});

const huiZongChicangList = computed(() => {
  let huizongobj = {}
  newChicangList.value.forEach(item => {
    if (huizongobj[`${item['合约ID']}_${item['买卖']}`]) {
      let obj = { ...huizongobj[`${item['合约ID']}_${item['买卖']}`] }
      obj.idx = obj.idx * 1 + 1
      obj['ID'] = obj['ID'] > item['ID'] ? obj['ID'] : item['ID']
      obj['合约ID买卖'] = `${item['合约ID']}_${item['买卖']}`
      obj['持仓量'] = obj['持仓量'] * 1 + item['持仓量'] * 1
      obj['可平量'] = obj['可平量'] * 1 + item['可平量'] * 1
      obj['持仓均价'] = obj['持仓均价'] * 1 + item['持仓均价'] * 1
      obj['手续费'] = obj['手续费'] * 1 + item['手续费'] * 1
      obj['浮动盈亏'] = obj['浮动盈亏'] * 1 + item['浮动盈亏'] * 1
      obj['盈利价差'] = obj['盈利价差'] * 1 + item['盈利价差'] * 1
      obj['保证金'] = obj['保证金'] * 1 + item['保证金'] * 1
      obj['资金占比'] = obj['资金占比'] * 1 + item['资金占比'] * 1
      huizongobj[`${item['合约ID']}_${item['买卖']}`] = obj
    } else {
      item.idx = 1
      item['合约ID买卖'] = `${item['合约ID']}_${item['买卖']}`
      huizongobj[`${item['合约ID']}_${item['买卖']}`] = { ...item }
    }
  })
  let arr = Object.values(huizongobj).map(item => {
    item['持仓均价'] = parseFloat((item['持仓均价'] / item.idx).toFixed(hqdata.value[item['合约ID']].reserv_num * 1 + 1))
    item['浮盈比例'] = parseFloat((item['浮动盈亏'] / item['保证金'] * 100).toFixed(hqdata.value[item['合约ID']].reserv_num * 1 + 1))
    item['盈利价差'] = parseFloat((item['盈利价差'] / item.idx).toFixed(hqdata.value[item['合约ID']].reserv_num * 1 + 1))
    item['逐笔浮盈'] = parseFloat((item['浮动盈亏'] / item['持仓量']).toFixed(hqdata.value[item['合约ID']].reserv_num * 1 + 1))
    return item
  })
  arr.sort((a, b) => b['ID'] - a['ID']);
  return arr
})

const newChicangList = computed(() => {
  if (hyData.value.length <= 0 || !hqdata.value) return []
  let chiList = Object.values(chicangList.value)
  let arr = chiList.map(item => {
    if (item['可平量'] == 0) return
    return setchiCnagL(item)
  })
  arr = arr.filter(item => item)
  arr.sort((a, b) => b['ID'] - a['ID']);
  return arr
})

// const sunyingList = computed(() => {
//   let arr = Object.values(chicangList.value).filter(item => item['止盈止损ID'])
//   let arr2 = huiZongChicangList.value.filter(item => item['止盈止损ID'])
//   let arr3 = [...arr, ...arr2]
//   let arr4 = []
//   arr3.forEach(item => {
//     if (!arr4.some(it => it['ID'] == item['ID'])) {
//       arr4.push(item)
//     }
//   })
//   return arr4
// })

const filersZiji = computed(() => {
  let v = zijinObj[bizhong.value];
  let obj = { 权益: 0, 可用资金: 0, 资金使用率: 0 };
  if (!v) return obj;
  let price1 = parseFloat(
    (v["账户余额"] * 1 - v["冻结金额"] * 1 + v["浮动盈亏"] * 1).toFixed(4)
  ),
    price2 = parseFloat(
      (
        v["账户余额"] * 1 -
        v["冻结金额"] * 1 +
        v["浮动盈亏"] * 1 -
        v["占用保证金"] * 1
      ).toFixed(4)
    ),
    price3 =
      v["账户余额"] == "0.00" || v["账户余额"] == 0
        ? "0.00"
        : parseFloat(
          (
            ((v["冻结金额"] * 1 + v["浮动盈亏"] * 1 - v["占用保证金"] * 1) /
              v["账户余额"]) *
            100
          ).toFixed(4)
        );

  obj["权益"] = isNaN(price1) ? "" : price1;
  obj["可用资金"] = isNaN(price2) ? "" : price2;
  obj["资金使用率"] = isNaN(price3) ? "" : price3;
  return obj;
});
const ordercanshu = reactive(JSON.parse(localStorage.getItem('ordercanshu')) || {
  fanshouprice: 1,
  bilipingcangprice: 1,
  buytype: 1,
  confirmation: 1,
  doubleClickFastLiquidation: 2,
  confirmation2: 1,
  doubleClickFastLiquidation2: 2,
  shengYin: true,
  buyOrderXY: true,
  maxNumKaiClick: false,
  chiCangListFenLie: false,
  shuangJiCHiCnag: false,
  maxNumClick: false,
  // logquxianshi:1
})
const sizeObj = reactive({
  width: 1280,
  height: 345
})
const chuanTongInfo = reactive({
  sellBuy: 1,
  kaiPing: 1,
  num: 1,
  price: 0,
})
const storeMain = mainStore();
storeMain.getConfigJsInfo("heyueinfo", { type: 1, lb: "1" });
const numberOfOrdersByDefault = ref(JSON.parse(localStorage.getItem('numberOfOrdersByDefault')) || {})

const sunyingList = ref({})
const zijinObj = reactive({})
const bizhong = ref(1)
const iszijin = ref('')
const diaoMsg = ref(null)
const tiaojianInfo = ref({})
const heyueying = ref({})
const heyuesun = ref({})
const clientId = ref(null)
const loginInfo = ref(null);
// const zijin = ref({});
const suoPrice = ref(false);
const isShowLeft = ref(true);
const selectMulu = ref(0);
const showRight = ref(0);
const isoneMore = ref(true);
const istwoMore = ref(true);
const isSelectPrice = ref(false);
const selectPrice = ref(1);
const isViewList = ref(false);
const shangpinInfo = ref({
  heyue_bh: '',
  heyueBh: '',
  reservNum: 1,
  xiadanPrice: ''
})
const heyueData = ref([])
const heyuTable = ref([])
const client = ref(null)
const mqttxintiao = ref(null)
const mqttxintiaoHangQing = ref(null)
const reconnecttotal = ref(0)
const reconnecttotalHangQing = ref(0)
const hagnqingData = ref(null)
const hyData = ref({})
const hqdata = ref(null)
const kuaijiejia = ref('市价')
const showkuaijiejia = ref(true)
const activeList = ref('持仓汇总')
const activelishiList = ref('历史委托')
const chicangList = ref({})
const chicangActive = ref(null)
const weituoList = ref([])
const tiaoJianList = ref([])
const chengjiaoList = ref([])
// const zhiYing = ref(0)
// const zhiSun = ref(0)
// const IP = ref(null)
const zijinliushui = ref([])
const gendanList = ref([])
const paiHangBangListZong = ref([])
const gongGaoList = ref([])
const ischurujinRefresh = ref(false)
const isopenCkickZiJinLiuShui = ref(false)
const zhuanHuanInfo = ref({
  name1: "美元",
  name2: "人民币",
  val1: 0,
  val2: 0,
});

const gendanForm = ref({
  用户ID: "",
  合约ID: "0",
  操作类别: "0",
  数量: "1",
  跟单类别: "0",
  用户编号: "",
  数量类别: "0",
});
const paihangbangFrom = ref({
  日期: "1",
  币种: "1",
  盈亏: false,
});

const huilvdetailInfo = ref([]);
const huilvObj = ref({});

const passwordfrom = ref({
  oldpass: "",
  newpass: "",
  okpass: "",
  type: 1,
});
const historyTrading = ref({
  time: moment().format("YYYY-MM-DDTHH:mm:ss"),
  timeEnd: moment().format("YYYY-MM-DDTHH:mm:ss"),
  huobiId: 0,
});
const historyTradingList = ref({
  weituo: [],
  chengjiao: [],
  pingcang: [],
});
const paiHangBangList = computed(() => {
  let obj = { 1: [], 2: [], 3: [], 4: [] };
  let yingkui = paihangbangFrom.value["盈亏"] ? 2 : 1;
  paiHangBangListZong.value.forEach((item) => {
    if (
      item["币种"] == paihangbangFrom.value["币种"] &&
      item["排行榜类别"] == yingkui
    ) {
      if (item["排行期间"] == 1) {
        obj["1"].push(item);
      }
      if (item["排行期间"] == 2) {
        obj["2"].push(item);
      }
      if (item["排行期间"] == 3) {
        obj["3"].push(item);
      }
      if (item["排行期间"] == 4) {
        obj["4"].push(item);
      }
    }
  });
  return obj[paihangbangFrom.value["日期"]];
});
const singleTableRef = ref();
const chicangHuizongRef = ref();
const isMaxNumShow = ref(false);
const MaxNumVal = ref(0);
const wucaozuoTime = ref(null)
const xianluTime = ref(null)

watch(ordercanshu, newVal => {
  localStorage.setItem('ordercanshu', JSON.stringify(newVal))
}, { deep: true })

watch(numberOfOrdersByDefault, newVal => {
  localStorage.setItem('numberOfOrdersByDefault', JSON.stringify(newVal))
}, { deep: true })

watch(
  [shangpinInfo, heyueData],
  () => {
    ipcRenderer.send("right_click_msg", {
      type: "下单信息传输",
      orderInfo: JSON.stringify(shangpinInfo.value),
      heyueData: JSON.stringify(heyueData.value),
    });
  },
  { deep: true }
);

watch(
  () => zijinObj[bizhong.value],
  () => {
    ipcRenderer.send("right_click_msg", {
      type: "个人信息传输",
      userInfo: JSON.stringify({
        bh: loginInfo.value.bh,
        quanyi: filersZiji.value["权益"],
        keyong: filersZiji.value["可用资金"],
        shiyognlv: filersZiji.value["资金使用率"],
      }),
    });
  },
  { deep: true }
);

watch(
  () => historyTrading,
  () => {
    switchlishiList(activelishiList.value);
  },
  { deep: true }
);
watch(() => shangpinInfo.value.heyue_bh, newVal => {
  if (newVal) {
    if (shangpinInfo.value.islist == 1) {
      return
    }
    ipcRenderer.send("right_click_msg", {
      type: "切换合约",
      orderInfo: JSON.stringify(shangpinInfo.value)
    });
  }
})

onMounted(() => {
  let tjInfo = tiaoJianTxt.readLogs()
  tiaojianInfo.value = tjInfo ? JSON.parse(tjInfo) : {}

  let tTimeSize = null
  ipcRenderer.on("placeAnOrderWindow-resize", async (e, v) => {
    clearTimeout(tTimeSize)
    tTimeSize = setTimeout(() => {
      sizeObj.width = v.width
      sizeObj.height = v.height
    }, 200)
  })
  ipcRenderer.on("placeAnOrder", async (e, v) => {
    loginInfo.value = v.val;
    v.val.zijin.forEach(item => {
      zijinObj[item.hb_id] = {
        币种: item.hb_id,
        账户余额: item.yue,
        冻结金额: item.dongjie,
        浮动盈亏: item.float_yk,
        隔夜风险金: item.geye_baozheng,
        风险金: 0,
        占用保证金: item.jian_baozheng,
        上次结算准备金: item.zhunbeijin,
        今日入金: item.rujin,
        今日出金: item.chujin,
        今日调整: item.tiaozheng,
        今日划拨: item.huabo,
        平仓盈亏: item.pingcang_yk,
        手续费: item.shouxufei,
      };
    })
    await gethuilvdetail();
    contentMqtt();
    contentMqttHangQing();
    ipcRenderer.send("right_click_msg", {
      type: "下单信息传输",
      orderInfo: JSON.stringify(shangpinInfo.value),
      heyueData: JSON.stringify(heyueData.value),
    });
    ipcRenderer.send("right_click_msg", {
      type: "个人信息传输",
      userInfo: JSON.stringify({
        bh: loginInfo.value.bh,
        quanyi: filersZiji.value["权益"],
        keyong: filersZiji.value["可用资金"],
        shiyognlv: filersZiji.value["资金使用率"],
      }),
    });
  });
  ipcRenderer.on("select-heyue", (e, v) => {
    if (suoPrice.value) {
      return;
    }
    shangpinInfo.value = { ...shangpinInfo.value, ...v };
    getShangpinInfo();
  });
  ipcRenderer.on("send-zijinLiushui—shauxin", () => {
    ischurujinRefresh.value = true;
    openZiJin();
  });
  ipcRenderer.on("hua_xian_xia_dan_data", (e, v) => {
    let obj = JSON.parse(v);
    if (v.type == "买") {
      publish(
        `15;${obj.heyue_id};${obj.num};${obj.YValue};1;${heyueying.value[obj.heyue_zu_id] || 0};${heyuesun.value[obj.heyue_zu_id] || 0};0;${clientId.value}`
      );
    }
    if (v.type == "卖") {
      publish(
        `15;${obj.heyue_id};${obj.num};${obj.YValue};2;${heyueying.value[obj.heyue_zu_id] || 0};${heyuesun.value[obj.heyue_zu_id] || 0};1;${clientId.value}`
      );
    }
  });
  ipcRenderer.on("send-sunYing-info", (e, v) => {
    let obj = JSON.parse(v);
    let str = `18;${obj["持仓ID"] || 0};${obj["止盈止损ID"] || 0};${obj["合约ID"]};${obj["方向"]
      };${obj["数量"]};${obj["止盈价位"] || 0};${obj["止损价位"] || 0};${obj["止盈金额"] || 0
      };${obj["止损金额"] || 0};0;100;${clientId.value}`
    if (activeList.value == '持仓汇总') {
      str = `18;0;0;${obj["合约ID"]};${obj["方向"]
        };${obj["数量"]};${obj["止盈价位"] || 0};${obj["止损价位"] || 0};${obj["止盈金额"] || 0
        };${obj["止损金额"] || 0};0;100;${clientId.value}`
    }
    publish(str);
  });
  ipcRenderer.on("right_click_msg_win", async (e, v) => {
    if (v.type == "修改写入条件单") {
      let tjInfo = tiaoJianTxt.readLogs()
      tiaojianInfo.value = tjInfo ? JSON.parse(tjInfo) : {}
    }
    if (v.type == "工具条下单") {
      if (v.status == 4) {
        ipcRenderer.send("open-chedanview", JSON.stringify(tiaoJianList.value));
        return;
      }
      toolbarOrder(v);
    }
    if (v.type == "撤单指令发送") {
      xiandanBtnTap(v.status, JSON.parse(v.v));
    }
    if (v.type == "查余额") {
      ipcRenderer.send("send-zhanghu-yue", zijinObj[bizhong.value]["账户余额"]);
    }
    if (v.type == "损盈下单") {
      let type = v.active
      if (type == 1 || type == 2) {
        let xiadanPrice = getPrice(type) == '市价' ? 0 : getPrice(type)
        publish(`15;${shangpinInfo.value.heyue_id};${shangpinInfo.value.reservNum};${xiadanPrice};${type};${v.ying || 0};${v.sun || 0};${type == 1 ? 0 : 1};${clientId.value}`)
        ipcRenderer.send('close-stopLossOpen')
        let typeOrder = type == 1 ? '买入' : '卖出'
        logHandler.writeLog(`普通单`, `点击${typeOrder}[${shangpinInfo.value.heyue_id}][${getPrice(type)}][${shangpinInfo.value.reservNum}]`, loginInfo.value.bh)
      }
    }
    if (v.type == "添加条件单") {
      let { heyue_id, reservNum, xiadanPrice, buySell, kaiPing, heyue_zu_id } = JSON.parse(v.shangpinInfo)
      if (kaiPing == 1) {
        publish(`15;${heyue_id};${reservNum};${xiadanPrice};${buySell};${heyueying.value[heyue_zu_id] || 0};${heyuesun.value[heyue_zu_id] || 0};${buySell == 1 ? 0 : 1};${clientId.value}`)
        let typeOrder = buySell == 1 ? '买入' : '卖出'
        logHandler.writeLog(`普通单`, `${typeOrder}[${heyue_id}][${xiadanPrice}][${reservNum}]`, loginInfo.value.bh)
      }
      if (kaiPing == 2) {
        publish(`17;${heyue_id};${reservNum};${xiadanPrice};${buySell};0;${buySell};${clientId.value}`)
        logHandler.writeLog(`普通单`, `条件平仓合约${heyue_id}[${xiadanPrice}][${reservNum}]`, loginInfo.value.bh)
      }
    }
  });
  noOperationPrompt()
});
onUnmounted(() => {
  clearTimeout(wucaozuoTime.value)
})
// function switchCurrency() {
//   bizhong.value = bizhong.value == 1 ? 3 : 1
// }
function conditionSingleTrigger({ heyue_bh, price }) {
  if (tiaojianInfo.value[heyue_bh]) {
    let arr = Object.values(tiaojianInfo.value[heyue_bh])
    let obj = arr.find(item => {
      if (item.jiageState == 102) {
        return item.price >= price
      }
      if (item.jiageState == 101) {
        return item.price <= price
      }
      return false
    })
    if (obj && obj.state == 1 && obj.isCHuFa == 1) {
      tiaojianInfo.value[heyue_bh][obj.Guid] = { ...obj, state: 3, isCHuFa: 2 }
      buytiaojiandan(obj)
      diaoMsg.value.open('画线单已经满足价格条件已触发')
      tiaoJianTxt.writeLog(JSON.stringify(tiaojianInfo.value))
    }
  }
}

function buytiaojiandan({ maimai, price, num, heyue_id, heyue_zu_id }) {
  if (maimai == '买' || maimai == '卖') {
    let typeOrder = maimai == '买' ? 1 : 2
    publish(`15;${heyue_id};${num};${price};${typeOrder};${heyueying.value[heyue_zu_id] || 0};${heyuesun.value[heyue_zu_id] || 0};${typeOrder == 1 ? 0 : 1};${clientId.value}`)
    logHandler.writeLog(`条件单`, `画线下单${maimai}[${heyue_id}][${price}][${num}]`, loginInfo.value.bh)
  }
}

function openConditionList() {
  ipcRenderer.send('open-conditionList', { classHeyue: JSON.stringify(classHeyue.value), heyue_id: shangpinInfo.value.heyue_id })
}

function cTPrice(type) {
  let price = chuanTongInfo.price
  if (type == 1) {
    price = price - bodongVal.value
  }
  if (type == 2) {
    price = price * 1 + bodongVal.value * 1
  }
  chuanTongInfo.price = price <= 0 ? 0 : price
}
function huifuChuanTOng() {
  chuanTongInfo.sellBuy = 1
  chuanTongInfo.kaiPing = 1
  chuanTongInfo.num = 1
  chuanTongInfo.price = 0

}
function jianNum() {
  let num = chuanTongInfo.num
  num--
  if (num <= 0) {
    num = 0
  }
  chuanTongInfo.num = num
}
function tableRowClassName({ row }) {
  if (activeList.value == '持仓汇总') {
    if (!chicangActive.value || !chicangActive.value['合约ID买卖']) return ''
    return chicangActive.value["合约ID买卖"] == row['合约ID买卖'] ? 'selected-row' : ''
  }
  if (activeList.value == '持仓') {
    if (!chicangActive.value || !chicangActive.value['ID']) return ''
    return chicangActive.value["ID"] == row['ID'] ? 'selected-row' : ''
  }

}
function noOperationPrompt() {
  clearTimeout(wucaozuoTime.value)
  wucaozuoTime.value = setTimeout(async () => {
    clearTimeout(wucaozuoTime.value)
    ipcRenderer.send("closeplaceAnOrder");
    let res = await diaoMsg.value.open('已经180分钟没有操作，交易自动退出，是否重新登录？', 2)
    if (res) {
      ipcRenderer.send('right_click_msg', { type: '打开下单' })
    }
  }, 1000 * 60 * 180);
}
function formatizeNmme(str) {
  if (str.length > 2) {
    return str[0] + '**' + str[str.length - 1];
  }
  return str[0];
}
const sumbitYingSun = throttle(async function (type) {
  let msg = type == 2 ? '确认取消所有止盈止损设置' : '确认提交止盈止损设置'
  let isNext = await diaoMsg.value.open(msg, 2)
  if (!isNext) return
  let arr = Object.keys(heyueying.value).map(item => {
    if (type == 2) {
      heyueying.value[item] = ''
      heyuesun.value[item] = ''
    }
    return {
      hy_id: item,
      ying: heyueying.value[item] || 0,
      sun: heyuesun.value[item] || 0,
    }
  })
  let { data } = await axios.post(storeMain.xianlu.url + "/point", { list: arr }, {
    headers: {
      // 自定义的请求头
      token: loginInfo.value.token,
    },
  });
  if (data.code == 0) {
    ElMessage({ message: '止盈止损参数修改成功', type: "success" });
  } else {
    ElMessage({ message: data.msg, type: "error" });
  }
}, 1000)

const editpassword = throttle(async function () {
  if (!passwordfrom.value.oldpass) {
    return ElMessage({ message: "请填写原密码", type: "warning" });
  }
  if (!passwordfrom.value.newpass) {
    return ElMessage({ message: "请填写新密码", type: "warning" });
  }
  if (!passwordfrom.value.okpass) {
    return ElMessage({ message: "请填写确认密码", type: "warning" });
  }
  if (passwordfrom.value.okpass != passwordfrom.value.newpass) {
    return ElMessage({ message: "新密码与确认密码不一致", type: "warning" });
  }
  let from = {
    oldpass: md5Encrypt(passwordfrom.value.oldpass),
    newpass: md5Encrypt(passwordfrom.value.newpass),
    okpass: md5Encrypt(passwordfrom.value.okpass),
    type: passwordfrom.value.type,
  };
  let { data } = await axios.post(storeMain.xianlu.url + "/editpass", from, {
    headers: {
      // 自定义的请求头
      token: loginInfo.value.token,
    },
  });
  if (data.code == 0) {
    ElMessage({ message: data.msg, type: "success" });
  } else {
    ElMessage({ message: data.msg, type: "error" });
  }
}, 1000);
function md5Encrypt(text) {
  return CryptoJS.MD5(text).toString();
}

function setchiCnagL(item) {
  let hyDataInfo = hyData.value[item['合约ID']]
  let hagnqingInfo = hqdata.value[item['合约ID']]
  let price = 0
  // USDfloatParice = 0
  if (!hyDataInfo && !hagnqingInfo) {
    item['浮动盈亏'] = price
    // item['浮动盈亏(USD)'] = USDfloatParice
    item['保证金'] = ''
    item['资金占比'] = ''
    item['逐笔浮盈'] = ''
    item['盈利价差'] = ''
    item['浮盈比例'] = ''
    return item
  }
  if (item.currentPrice) {
    if (hagnqingInfo.currentPrice == item.currentPrice) {
      return item
    }
  } else {
    item.currentPrice = hagnqingInfo.currentPrice
  }
  let bd = parseFloat(hyDataInfo['最小波动'])
  let pina = String(bd).indexOf('.')
  pina = pina == -1 ? 0 : String(bd).split('.')[1].length
  let jiacha = 0
  if (item['买卖'] == 1) {
    price = (hagnqingInfo.currentPrice - item['持仓均价']) * hyDataInfo['客户端合约乘数'] * item['持仓量']
    jiacha = parseFloat((hagnqingInfo.currentPrice - item['持仓均价']).toFixed(pina))
  }
  if (item['买卖'] == 2) {
    price = (item['持仓均价'] - hagnqingInfo.currentPrice) * hyDataInfo['客户端合约乘数'] * item['持仓量']
    jiacha = parseFloat((item['持仓均价'] - hagnqingInfo.currentPrice).toFixed(pina))
  }
  item['浮动盈亏'] = parseFloat(price.toFixed(pina))
  // let benbi = huilvObj.value[item['币种']].bilv
  // let USDbi = huilvObj.value[3].bilv
  // USDfloatParice = price * benbi / USDbi
  // item['浮动盈亏(USD)'] = parseFloat(USDfloatParice.toFixed(pina))
  let bzj = hyDataInfo['建仓保证金'] * item['持仓量']
  item['保证金'] = parseFloat(bzj.toFixed(pina))
  let zijinzhanbi = String(item['保证金'] / filersZiji.value["可用资金"])
  // let zjFixd = String(filersZiji.value["可用资金"])
  // zjFixd = zjFixd.split('.')[0]
  // zjFixd = zjFixd.length - 2 <= 0 ? 0 : zjFixd.length - 2
  item['资金占比'] = parseFloat(Number(zijinzhanbi).toFixed(2) * 100)
  item['逐笔浮盈'] = parseFloat((item['浮动盈亏'] / item['持仓量']).toFixed(2))
  item['盈利价差'] = jiacha
  item['浮盈比例'] = parseFloat((item['浮动盈亏'] / bzj * 100).toFixed(2))
  return item
}

async function gethuilvdetail() {
  clearTimeout(xianluTime.value)
  if (!storeMain.xianlu) {
    xianluTime.value = setTimeout(() => {
      gethuilvdetail()
    }, 1000);
    return
  }

  let { data } = await axios.post(
    storeMain.xianlu.url + "/huilvdetail",
    {},
    {
      headers: {
        // 自定义的请求头
        token: loginInfo.value.token,
      },
    }
  );
  if (data.code == 0) {
    huilvdetailInfo.value = data.data;
    data.data.forEach((item) => {
      huilvObj.value[item.hb_id] = item;
    });
  } else {
    ElMessage({ message: data.msg, type: "error" });
  }
  await getHeYueYingSun()
}
async function getHeYueYingSun() {
  let res2 = await axios.post(storeMain.xianlu.url + "/findpoint", { hy_id: 0 }, {
    headers: {
      // 自定义的请求头
      token: loginInfo.value.token,
    },
  });
  if (res2.data.code == 0) {
    res2.data.data.forEach(item => {
      heyueying.value[item.hy_id] = item.ying_float || ''
      heyuesun.value[item.hy_id] = item.sun_float || ''
    })
  } else {
    ElMessage({ message: res2.data.msg, type: "error" });
  }
}

function activeShop(v) {
  shangpinInfo.value.heyue_id = v["合约ID"];
  getShangpinInfo();
}
const chicangHandleRowClick = (v) => {
  chicangActive.value = v;
  if (suoPrice.value) {
    return
  }
  shangpinInfo.value.heyue_id = v["合约ID"];
  // chicangActive.value = v;
  getShangpinInfo();
};

const getShangpinInfo = throttle(function (type) {
  if (suoPrice.value) {
    return;
  }
  if (shangpinInfo.value.heyue_id && hqdata.value) {
    let hagnqinInfo = hqdata.value[shangpinInfo.value.heyue_id];
    if (hagnqinInfo) {
      shangpinInfo.value = { ...shangpinInfo.value, ...hagnqinInfo };
      shangpinInfo.value.heyueBh = shangpinInfo.value.heyue_bh;
      if (type != 1) {
        let defaultNum = numberOfOrdersByDefault.value[shangpinInfo.value.heyue_zu_id]
        shangpinInfo.value.reservNum = defaultNum === 0 ? 0 : defaultNum ? defaultNum : 1
        chuanTongInfo.num = shangpinInfo.value.reservNum
      }
    } else {
      shangpinInfo.value = {
        heyue_bh: "",
        heyueBh: shangpinInfo.value.heyueBh,
        reservNum: 1,
        xiadanPrice: 0,
      };
    }
  }
}, 0);
const inputShangpinInfo = throttle(function () {
  if (shangpinInfo.value.heyueBh && hagnqingData.value) {
    let hagnqinInfo = hagnqingData.value[shangpinInfo.value.heyueBh];
    if (hagnqinInfo) {
      shangpinInfo.value = { ...shangpinInfo.value, ...hagnqinInfo, islist: null };
      let defaultNum = numberOfOrdersByDefault.value[shangpinInfo.value.heyue_zu_id]
      shangpinInfo.value.reservNum = defaultNum === 0 ? 0 : defaultNum ? defaultNum : 1
      chuanTongInfo.num = shangpinInfo.value.reservNum
    } else {
      shangpinInfo.value = {
        heyue_bh: "",
        heyueBh: shangpinInfo.value.heyueBh,
        reservNum: 1,
        xiadanPrice: 0,
      };
    }
  }
}, 0);

function toolbarOrder(val) {
  let type = val.status,
    orderInfo = JSON.parse(val.orderInfo);
  if (!orderInfo.heyue_id) {
    return ElMessage({ message: "请选择合约", type: "error" });
  }
  if (type == 1 || type == 2) {
    let xiadanPrice =
      gettoolbarPrice(type, orderInfo) == "市价"
        ? 0
        : gettoolbarPrice(type, orderInfo);
    publish(
      `15;${orderInfo.heyue_id};${orderInfo.buynum};${xiadanPrice};${type};${heyueying.value[orderInfo.heyue_zu_id] || 0
      };${heyuesun.value[orderInfo.heyue_zu_id] || 0};${type == 1 ? 0 : 1};${clientId.value}`
    );
    let typeOrder = type == 1 ? "买入" : "卖出";
    logHandler.writeLog(
      `普通单`,
      `点击${typeOrder}[${orderInfo.heyue_id}][${gettoolbarPrice(
        type,
        orderInfo
      )}][${orderInfo.buynum}]`,
      loginInfo.value.bh
    );
  }
  if (type == 3) {
    let selectChicangList = Object.values(chicangList.value).filter(
      (item) => item["合约ID"] == orderInfo.heyue_id
    );
    if (selectChicangList.length <= 0)
      return ElMessage({ message: "无可平单", type: "error" });
    let pinInfo = selectChicangList[selectChicangList.length - 1];
    let xiadanPrice = 0;
    if (showkuaijiejia.value) {
      let hagnqingInfo = hqdata.value[pinInfo["合约ID"]];
      if (hagnqingInfo) {
        xiadanPrice =
          gettoolbarPrice(pinInfo["买卖"] == 1 ? 2 : 1, orderInfo) == "市价"
            ? 0
            : gettoolbarPrice(pinInfo["买卖"] == 1 ? 2 : 1, orderInfo);
      }
    }
    publish(
      `17;${pinInfo["合约ID"]};${pinInfo["可平量"]};${xiadanPrice};${pinInfo["买卖"]
      };${pinInfo["ID"]};${pinInfo["买卖"] == 1 ? 0 : 1};${clientId.value}`
    );
    logHandler.writeLog(
      `普通单`,
      `点击平仓${pinInfo["合约ID"]}`,
      loginInfo.value.bh
    );
  }
}

const gettoolbarPrice = (type, orderInfo) => {
  let price = "";
  if (orderInfo.kuaijie) {
    switch (orderInfo.kuaijie) {
      case "对手价":
        price =
          type == 1 ? shangpinInfo.value.seller1 : shangpinInfo.value.buy1;
        price = price || "0.00";
        break;
      case "市价":
        price = "市价";
        break;
      case "最新价":
        price = shangpinInfo.value.currentPrice || "0.00";
        break;
    }
  } else {
    price = orderInfo.buyPaice || "0.00";
  }
  return price;
};

const buyShop = throttle(async function (type) {
  if (type == 1 || type == 2) {
    if (!shangpinInfo.value.heyue_id) {
      return ElMessage({ message: "请选择合约", type: 'error' });
    }
    let typeOrder = type == 1 ? '买入' : '卖出'
    if (ordercanshu.confirmation == 1) {
      let msgPrice = shangpinInfo.value.xiadanPrice
      if (showkuaijiejia.value) {
        msgPrice = kuaijiejia.value
      }
      let msg = `委托 ${typeOrder} ${shangpinInfo.value.heyue_name} 数量：${shangpinInfo.value.reservNum} 价格：${msgPrice}`
      let isNext = await diaoMsg.value.open(msg, 2)
      if (!isNext) {
        return
      }
    }
    let xiadanPrice = getPrice(type) == '市价' ? 0 : getPrice(type)
    publish(`15;${shangpinInfo.value.heyue_id};${shangpinInfo.value.reservNum};${xiadanPrice};${type};${heyueying.value[shangpinInfo.value.heyue_zu_id] || 0};${heyuesun.value[shangpinInfo.value.heyue_zu_id] || 0};${type == 1 ? 0 : 1};${clientId.value}`)
    logHandler.writeLog(`普通单`, `点击${typeOrder}[${shangpinInfo.value.heyue_id}][${getPrice(type)}][${shangpinInfo.value.reservNum}]`, loginInfo.value.bh)
  }

  if (type == 3) {
    let active = chicangActive.value
    if (active) {
      let obj = hqdata.value[chicangActive.value['合约ID']]
      let price = 0
      if (obj) {
        if (ordercanshu.bilipingcangprice == 2) {
          if (chicangActive.value['买卖'] == 1) {
            price = obj.seller1
          }
          if (chicangActive.value['买卖'] == 2) {
            price = obj.buy1
          }
        }
        if (ordercanshu.bilipingcangprice == 3) {
          price = obj.currentPrice
        }
      }

      // let xiadanPrice = getPrice(active['买卖'] == 1 ? 2 : 1) == '市价' ? 0 : getPrice(active['买卖'] == 1 ? 2 : 1)
      // if (ordercanshu.confirmation == 1) {
      //   let msgPrice = shangpinInfo.value.xiadanPrice
      //   if (showkuaijiejia.value) {
      //     msgPrice = kuaijiejia.value
      //   }
      //   let msg = `平${active['买卖'] == 1 ? '买' : '卖'}仓 ${shangpinInfo.value.heyue_name} 数量：1 价格：${msgPrice}`
      //   let isNext = await diaoMsg.value.open(msg, 2)
      //   if (!isNext) {
      //     return
      //   }
      // }
      let str = `17;${active['合约ID']};1;${price};${active['买卖']};${active['ID']};${active['买卖'] == 1 ? 0 : 1};${clientId.value}`
      if (activeList.value == '持仓汇总') {
        str = `17;${active['合约ID']};1;${price};${active['买卖']};0;${active['买卖'] == 1 ? 0 : 1};${clientId.value}`
      }
      publish(str)
      logHandler.writeLog(`普通单`, `点击平仓${active['合约ID']}`, loginInfo.value.bh)
    } else {
      diaoMsg.value.open('未选择平仓单！')
    }
  }
  chicangActive.value = null
  singleTableRef.value?.setCurrentRow()
  chicangHuizongRef.value?.setCurrentRow()
}, 1500)

const cTbuyShop = throttle(async function () {
  if (!shangpinInfo.value.heyue_id) {
    return ElMessage({ message: "请选择合约", type: 'error' });
  }
  if (!chuanTongInfo.num) {
    return ElMessage({ message: "请添加数量", type: 'error' });
  }
  let type = chuanTongInfo.sellBuy
  let kaiPing = chuanTongInfo.kaiPing
  if (kaiPing == 1) {
    if (ordercanshu.confirmation == 1) {
      let msg = `委托 ${type == 1 ? '买入' : '卖出'} ${shangpinInfo.value.heyue_name} 数量：${chuanTongInfo.num} 价格：${chuanTongInfo.price == 0 ? '市价' : chuanTongInfo.price}`
      let isNext = await diaoMsg.value.open(msg, 2)
      if (!isNext) {
        return
      }
    }
    publish(`15;${shangpinInfo.value.heyue_id};${chuanTongInfo.num};${chuanTongInfo.price};${type};${heyueying.value[shangpinInfo.value.heyue_zu_id] || 0};${heyuesun.value[shangpinInfo.value.heyue_zu_id] || 0};${type == 1 ? 0 : 1};${clientId.value}`)
  }
  if (kaiPing == 3) {
    if (ordercanshu.confirmation == 1) {
      let msg = `平${type == 1 ? '买' : '卖'}仓 ${shangpinInfo.value.heyue_name} 数量：${chuanTongInfo.num} 价格：${chuanTongInfo.price == 0 ? '市价' : chuanTongInfo.price}`
      let isNext = await diaoMsg.value.open(msg, 2)
      if (!isNext) {
        return
      }
    }
    publish(`17;${shangpinInfo.value.heyue_id};${chuanTongInfo.num};${chuanTongInfo.price};${type};0;${type == 1 ? 0 : 1};${clientId.value}`)
  }
  chicangActive.value = null
  singleTableRef.value?.setCurrentRow()
  chicangHuizongRef.value?.setCurrentRow()
}, 1500)



const openZiJin = () => {
  isopenCkickZiJinLiuShui.value = true;
  let stratDate = moment(
    new Date(new Date(new Date().toLocaleDateString()).getTime())
  ).valueOf();
  let endDate = moment(
    new Date(
      new Date(new Date().toLocaleDateString()).getTime() +
      24 * 60 * 60 * 1000 -
      1
    )
  ).valueOf();
  publish(
    `45;${loginInfo.value.uid};${parseInt(stratDate / 1000)};${parseInt(
      endDate / 1000
    )};0;`
  );
  zijinliushui.value = [];
};

const xiandanBtnTap = (type, v) => {
  if (type == "全部撤单") {
    publish(`30;${clientId.value}`);
    logHandler.writeLog(`操作`, `点击全部撤单`, loginInfo.value.bh);
  }
  if (type == "委托撤") {
    publish(`16;${v["报单编号"]};${clientId.value}`);
    logHandler.writeLog(
      `操作`,
      `点击委托撤单${v["报单编号"]}`,
      loginInfo.value.bh
    );
  }
};
const paiHangBangHandleRowClick = (v) => {
  gendanForm.value["用户编号"] = v["用户名"];
  gendanForm.value["用户ID"] = v["用户ID"];
};

const sumbitGendan = () => {
  let uid = gendanForm.value["用户ID"];
  publish(
    `27;1;0;${uid ? uid : 0};${gendanForm.value["合约ID"]};${gendanForm.value["操作类别"]
    };${gendanForm.value["数量"]};${gendanForm.value["跟单类别"]};${gendanForm.value["用户编号"]
    };-1;${gendanForm.value["数量类别"]};${clientId.value};`
  );
  logHandler.writeLog(
    `跟单`,
    `点击跟单[跟单合约ID${gendanForm.value["合约ID"]}]`,
    loginInfo.value.bh
  );
};
const quxiaoGendanTap = (v) => {
  publish(`27;3;${v["跟单ID号"]};${clientId.value};`);
  logHandler.writeLog(
    `跟单`,
    `点击取消跟单${v["跟单ID号"]}`,
    loginInfo.value.bh
  );
};

const tianruNum = (v) => {
  if (v == 1 && ordercanshu.maxNumKaiClick) {
    shangpinInfo.value.reservNum = MaxNumVal.value
  }
  if (v == 2 && ordercanshu.maxNumClick) {
    chuanTongInfo.num = MaxNumVal.value
  }
}

const chiCangdbClick = async (v) => {
  let isQiYong = false
  if (selectMulu.value == 0 && ordercanshu.doubleClickFastLiquidation == 1) {
    isQiYong = true
  }
  if (selectMulu.value == 1 && ordercanshu.doubleClickFastLiquidation2 == 1) {
    isQiYong = true
  }
  if (!isQiYong) {
    return
  }
  if (ordercanshu.shuangJiCHiCnag) {
    let msg = `平${v['买卖'] == 1 ? '买' : '卖'}仓 ${v['合约名称']} 数量：${v['可平量']} 价格：市价`
    let isNext = await diaoMsg.value.open(msg, 2)
    if (!isNext) {
      return
    }
  }
  let str = `17;${v['合约ID']};${v['可平量']};0;${v['买卖']};${v['ID']};${v['买卖'] == 1 ? 0 : 1};${clientId.value}`
  if (activeList.value == '持仓汇总') {
    str = `17;${v['合约ID']};${v['可平量']};0;${v['买卖']};0;${v['买卖'] == 1 ? 0 : 1};${clientId.value}`
  }
  publish(str)
  chicangActive.value = null
  singleTableRef.value?.setCurrentRow()
  chicangHuizongRef.value?.setCurrentRow()
}

const pingAll = (type, val) => {
  if (type == '平100' || type == '平50' || type == '平33') {
    if (!chicangActive.value) {
      ElNotification({
        title: `${type}提示`,
        message: `请选择合约`,
        dangerouslyUseHTMLString: true,
        type: 'error',
        position: 'bottom-right',
        duration: 1000, offset: 10,
      })
      return
    }
    // let xiadanPrice = 0
    let num = chicangActive.value['可平量']
    if (type == '平50') {
      num = parseInt(num * 0.5)
    }
    if (type == '平33') {
      num = parseInt(num * 0.33)
    }
    num = num <= 0 ? 1 : num
    // if (showkuaijiejia.value) {
    //   xiadanPrice = getPrice(chicangActive.value['买卖'] == 1 ? 2 : 1) == '市价' ? 0 : getPrice(chicangActive.value['买卖'] == 1 ? 2 : 1)
    // }
    let obj = hqdata.value[chicangActive.value['合约ID']]
    let price = 0
    if (obj) {
      if (ordercanshu.bilipingcangprice == 2) {
        if (chicangActive.value['买卖'] == 1) {
          price = obj.seller1
        }
        if (chicangActive.value['买卖'] == 2) {
          price = obj.buy1
        }
      }
      if (ordercanshu.bilipingcangprice == 3) {
        price = obj.currentPrice
      }
    }
    let str = `17;${chicangActive.value['合约ID']};${num};${price};${chicangActive.value['买卖']};${chicangActive.value['ID']};${chicangActive.value['买卖'] == 1 ? 0 : 1};${clientId.value}`
    if (activeList.value == '持仓汇总') {
      str = `17;${chicangActive.value['合约ID']};${num};${price};${chicangActive.value['买卖']};0;${chicangActive.value['买卖'] == 1 ? 0 : 1};${clientId.value}`
    }
    publish(str)
    logHandler.writeLog(`普通单`, `点击平仓${chicangActive.value['合约ID']}`, loginInfo.value.bh)
    chicangActive.value = null
    singleTableRef.value?.setCurrentRow()
    chicangHuizongRef.value?.setCurrentRow()
  }
  if (type == '反手') {
    if (!chicangActive.value) {
      ElNotification({
        title: '反手提示',
        message: `请选择合约`,
        dangerouslyUseHTMLString: true,
        type: 'error',
        position: 'bottom-right',
        duration: 1000, offset: 10,
      })
      return
    }
    let obj = hqdata.value[chicangActive.value['合约ID']]
    let price = 0
    if (obj) {
      if (ordercanshu.fanshouprice == 2) {
        if (chicangActive.value['买卖'] == 1) {
          price = obj.buy1
        }
        if (chicangActive.value['买卖'] == 2) {
          price = obj.seller1
        }
      }
      if (ordercanshu.fanshouprice == 3) {
        price = obj.currentPrice
      }
    }
    let str = `32;${chicangActive.value['合约ID']};${chicangActive.value['持仓量']};${price};${chicangActive.value['买卖']};${chicangActive.value['ID']};${chicangActive.value['买卖'] == 1 ? 0 : 1};${clientId.value};`
    if (activeList.value == '持仓汇总') {
      str = `32;${chicangActive.value['合约ID']};${chicangActive.value['持仓量']};${price};${chicangActive.value['买卖']};0;${chicangActive.value['买卖'] == 1 ? 0 : 1};${clientId.value};`
    }
    publish(str)
    logHandler.writeLog(`操作`, `点击反手[合约ID${chicangActive.value['合约ID']}]`, loginInfo.value.bh)
    chicangActive.value = null
    singleTableRef.value?.setCurrentRow()
    chicangHuizongRef.value?.setCurrentRow()
  }
  if (type == '损盈') {
    if (!chicangActive.value) {
      ElNotification({
        title: '损盈提示',
        message: `请选择合约`,
        dangerouslyUseHTMLString: true,
        type: 'error',
        position: 'bottom-right',
        duration: 1000, offset: 10,
      })
      return
    }
    let index = heyueData.value.findIndex(item => item['合约ID'] == chicangActive.value['合约ID'])
    chicangActive.value['持仓ID'] = chicangActive.value['ID']
    chicangActive.value['数量'] = chicangActive.value['持仓量']
    chicangActive.value['方向'] = chicangActive.value['买卖']
    if (activeList.value == '持仓汇总') {
      chicangActive.value['止盈止损ID'] = 0
      chicangActive.value['持仓ID'] = 0
    }
    let obj = hqdata.value[chicangActive.value['合约ID']]
    if (obj) {
      // chicangActive.value['止盈价位'] = obj.currentPrice
      // chicangActive.value['止损价位'] = obj.currentPrice
      chicangActive.value['位数'] = obj.reserv_num * 1 + 1
    }
    chicangActive.value = { ...heyueData.value[index], ...chicangActive.value }
    ipcRenderer.send('oepn-sunYing', JSON.stringify(chicangActive.value))
    chicangActive.value = null
    singleTableRef.value?.setCurrentRow()
    chicangHuizongRef.value?.setCurrentRow()
  }
  if (type == '损盈修改') {
    let obj = heyueData.value.find(item => item['合约ID'] == val['合约ID'])
    let valInfo = { ...obj, ...val }
    let chicangObj = {}
    if (valInfo['持仓ID'] != 0) {
      chicangObj = chicangList.value[valInfo['持仓ID']]
    } else {
      chicangObj = huiZongChicangList.value.find(item => item['合约ID'] == valInfo['合约ID'] && item['买卖'] == valInfo['方向'])
    }
    if (chicangObj) {
      valInfo['持仓均价'] = chicangObj['持仓均价']
    }
    let obj1 = hqdata.value[valInfo['合约ID']]
    if (obj1) {
      valInfo['位数'] = obj1.reserv_num * 1 + 1
    }
    ipcRenderer.send('oepn-sunYing', JSON.stringify(valInfo))
  }
  if (type == '损盈删除') {
    publish(`19;${val['止盈止损ID']};${clientId.value}`)
  }
  if (type == '锁仓') {
    if (!chicangActive.value) {
      return ElNotification({
        title: '锁仓提示',
        message: `请选择锁仓合约！`,
        dangerouslyUseHTMLString: true,
        type: 'info',
        position: 'bottom-right',
        duration: 1000, offset: 10,
      })
    }
    let buyChiCangNum = 0,
      sellChiCangNum = 0
    newChicangList.value.forEach(item => {
      if (item['合约ID'] != chicangActive.value['合约ID']) {
        return
      }
      if (item['买卖'] == 1) {
        buyChiCangNum += item['持仓量'] * 1
      }
      if (item['买卖'] == 2) {
        sellChiCangNum += item['持仓量'] * 1
      }
    })
    if (buyChiCangNum == sellChiCangNum) {
      return ElNotification({
        title: "锁仓提示",
        message: `此合约无需锁仓！`,
        dangerouslyUseHTMLString: true,
        type: "info",
        position: "bottom-right",
        duration: 1000, offset: 10,
      });
    }
    let orderType = buyChiCangNum < sellChiCangNum ? 1 : 2,
      orderNum = Math.abs(buyChiCangNum - sellChiCangNum),
      bz = orderType == 1 ? 0 : 1;
    publish(
      `15;${chicangActive.value['合约ID']};${orderNum};0;${orderType};0;0;${bz};${clientId.value}`
    );
    logHandler.writeLog(
      `操作`,
      `点击锁仓[合约ID${chicangActive.value['合约ID']}]`,
      loginInfo.value.bh
    );
  }
};

const kuaijiejiaTap = (v) => {
  kuaijiejia.value = v;
  showkuaijiejia.value = true;
  isSelectPrice.value = false;
};
const contentMqtt = () => {
  clientId.value = "pc" + Math.random().toString(16).substr(2, 8)
  client.value = mqtt.connect(loginInfo.value.tradeLine.node, {
    clean: true,
    clientId: clientId.value,
    connectTimeout: 40000,
    reconnectPeriod: 1000,
    password: `${loginInfo.value.token}`,
    username: `yh_${loginInfo.value.uid}_pc`,
  });

  client.value.on("connect", () => {
    window.clearInterval(mqttxintiao.value);
    mqttxintiao.value = window.setInterval(() => {
      client.value.publish("weituo", `50;${clientId.value}`, { qos: 2 });
    }, 30000);
    client.value.subscribe(
      `fanhui_${loginInfo.value.uid}`,
      { qos: 2 },
      (error) => {
        if (!error) {
          publish(`20;`);
          publish(`23;`);
          publish(`24;`);
          publish(`25;`);
          publish(`28;`);
          sunyingList.value = {}
          publish(`35;0;0;`);
          publish(`38;0;`)
          // 初始化
        } else {
          console.log("订阅失败");
        }
      }
    );
  });
  client.value.on("message", (topic, message) => {
    mqttMessage(message.toString());
  });

  client.value.on("reconnect", () => {
    reconnecttotal.value++;
    if (reconnecttotal.value >= 5) {
      if (client.value) client.value.end();
      client.value = null;
    }
  });
  client.value.on("error", () => {
    reconnecttotal.value++;
    if (client.value) client.value.end();
    client.value = null;
    if (reconnecttotal.value >= 5) {
      window.clearInterval(mqttxintiao.value);
      clearTimeout(wucaozuoTime.value)
      reconnecttotal.value = 0;
      ipcRenderer.send("set-networkdetail-log", "交易链接意外断线");
      ipcRenderer.send("right_click_msg", "软件退出登录");
      logHandler.writeLog(`系统`, `用户${loginInfo.value.bh} 交易链接意外断线`);
      ElMessage({ message: "交易链接错误断开，请重新登录", type: "error" });
      ipcRenderer.send("closeplaceAnOrder");
      return;
    }
    contentMqtt();
  });
  client.value.on("close", () => {
    clearTimeout(wucaozuoTime.value)
    window.clearInterval(mqttxintiao.value);
    if (client.value) client.value.end();
    client.value = null;
    ipcRenderer.send("set-networkdetail-log", "交易链接关闭");
    logHandler.writeLog(`系统`, `用户${loginInfo.value.bh} 交易链接关闭`);
    ElMessage({ message: "交易链接关闭，可重新登录", type: "error" });
    ipcRenderer.send("closeplaceAnOrder");
  });
};

const contentMqttHangQing = () => {
  let client = mqtt.connect(loginInfo.value.mqttUrl.wsMqtt_bj, {
    clean: true,
    clientId: "pc" + Math.random().toString(16).substr(2, 8),
    connectTimeout: 40000,
    reconnectPeriod: 1000,
    username: storeMain.username,
    password: storeMain.password,
  });

  client.on("connect", () => {
    window.clearInterval(mqttxintiaoHangQing.value);
    mqttxintiaoHangQing.value = window.setInterval(() => {
      if (client) client.publish("weituo", `50;${clientId.value}`, { qos: 2 });
    }, 30000);
    client.subscribe("hangqing/+", { qos: 2 }, (error) => {
      if (error) {
        ElMessage({ message: "订阅失败，按F5刷新重试", type: "error" });
      }
    });
  });
  client.on("message", (topic, message) => {
    setHagnqingData(message.toString());
  });

  client.on("reconnect", () => {
    reconnecttotalHangQing.value++;
    if (reconnecttotalHangQing.value >= 5) {
      if (client) client.end();
      client = null;
    }
  });
  client.on("error", () => {
    reconnecttotalHangQing.value++;
    if (client) client.end();
    client = null;
    if (reconnecttotalHangQing.value >= 5) {
      clearTimeout(wucaozuoTime.value)
      reconnecttotalHangQing.value = 0;
      window.clearInterval(mqttxintiaoHangQing.value);
      ipcRenderer.send("set-networkdetail-log", "行情链接意外断线");
      ipcRenderer.send("right_click_msg", "软件退出登录");
      logHandler.writeLog(`系统`, `用户${loginInfo.value.bh} 行情链接意外断线`);
      ElMessage({ message: "行情链接意外出错，请重新登录", type: "error" });
      ipcRenderer.send("closeplaceAnOrder");
      return;
    }
    contentMqttHangQing();
  });
  client.on("close", () => {
    clearTimeout(wucaozuoTime.value)
    window.clearInterval(mqttxintiaoHangQing.value);
    if (client) client.end();
    client = null;
    logHandler.writeLog(`系统`, `用户${loginInfo.value.bh} 行情链接关闭`);
    ipcRenderer.send("set-networkdetail-log", "行情链接关闭");
    ElMessage({ message: "行情链接关闭，可重新登录", type: "error" });
    ipcRenderer.send("closeplaceAnOrder");
  });
};

const publish = (message) => {
  let parameter = loginInfo.value.uid + ";" + message;
  console.log(`output->parameter`, parameter)
  client.value.publish("weituo", parameter, { qos: 2 });
};
const plyAudio = throttle(function () {
  playAudio()
}, 5000)

const mqttMessage = (msg) => {
  let dataArr = msg.split(';')
  let msgObj
  if (ordercanshu.shengYin) {
    if (dataArr[0] == 15 || dataArr[0] == 16 || dataArr[0] == 17 || dataArr[0] == 27 || dataArr[0] == 29 || dataArr[0] == 30 || dataArr[0] == 32) {
      plyAudio()
    }
  }
  switch (dataArr[0]) {
    case '4':
      if (dataArr[1] != 'a') {
        iszijin.value = dataArr[1]
      }
      if (!iszijin.value) {
        iszijin.value = 3
      }
      zijinObj[iszijin.value] = {
        ...zijinObj[iszijin.value],
        '币种': dataArr[1] == 'a' ? zijinObj[iszijin.value]['币种'] : dataArr[1],
        '账户余额': dataArr[2] == 'a' ? zijinObj[iszijin.value]['账户余额'] : dataArr[2],
        '冻结金额': dataArr[3] == 'a' ? zijinObj[iszijin.value]['冻结金额'] : dataArr[3],
        '浮动盈亏': dataArr[4] == 'a' ? zijinObj[iszijin.value]['浮动盈亏'] : dataArr[4],
        '风险金': dataArr[5] == 'a' ? zijinObj[iszijin.value]['风险金'] : dataArr[5],
        '隔夜风险金': dataArr[6] == 'a' ? zijinObj[iszijin.value]['隔夜风险金'] : dataArr[6],
        '占用保证金': dataArr[7] == 'a' ? zijinObj[iszijin.value]['占用保证金'] : dataArr[7],
        '红包余额': dataArr[8] == 'a' ? zijinObj[iszijin.value]['红包余额'] : dataArr[8],
        '冻结红包余额': dataArr[9] == 'a' ? zijinObj[iszijin.value]['冻结红包余额'] : dataArr[9],
      }
      break;
    case '5':
      if (dataArr[1] != 'a') {
        iszijin.value = dataArr[1]
      }
      if (!iszijin.value) {
        iszijin.value = 3
      }
      zijinObj[iszijin.value] = {
        ...zijinObj[iszijin.value],
        '币种': dataArr[1] == 'a' ? zijinObj[iszijin.value]['币种'] : dataArr[1],
        '上次结算准备金': dataArr[2] == 'a' ? zijinObj[iszijin.value]['上次结算准备金'] : dataArr[2],
        '今日入金': dataArr[3] == 'a' ? zijinObj[iszijin.value]['今日入金'] : dataArr[3],
        '今日出金': dataArr[4] == 'a' ? zijinObj[iszijin.value]['今日出金'] : dataArr[4],
        '今日调整': dataArr[5] == 'a' ? zijinObj[iszijin.value]['今日调整'] : dataArr[5],
        '今日划拨': dataArr[6] == 'a' ? zijinObj[iszijin.value]['今日划拨'] : dataArr[6],
        '今日货币转换': dataArr[7] == 'a' ? zijinObj[iszijin.value]['今日货币转换'] : dataArr[7],
        '平仓盈亏': dataArr[8] == 'a' ? zijinObj[iszijin.value]['平仓盈亏'] : dataArr[8],
        '手续费': dataArr[9] == 'a' ? zijinObj[iszijin.value]['手续费'] : dataArr[9],
        '隔夜费': dataArr[10] == 'a' ? zijinObj[iszijin.value]['隔夜费'] : dataArr[10],
      }
      break;
    case '15':
      if (dataArr[1] == 0) {
        msgObj = {
          title: '建仓提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        }
        logHandler.writeLog(`普通单`, `${dataArr[2]} `, loginInfo.value.bh)
      } else {
        let bsDirection = dataArr[6] == '1' ? '买' : '卖';
        msgObj = {
          title: '建仓提示',
          message: `<div class="trade-notifica"><div><span>委托数量：${dataArr[4]}</span><span>委托方向：${bsDirection}</span></div><div><span>委托价格：${dataArr[5] == '0' ? '市价' : dataArr[5]}</span></div></div>`,
          dangerouslyUseHTMLString: true,
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        }
        logHandler.writeLog(`普通单`, `委托成功数量：${dataArr[4]} 委托方向：${bsDirection}> 委托价格：${dataArr[5] == '0' ? '市价' : dataArr[5]} `, loginInfo.value.bh)
      }
      ElNotification(msgObj)
      ipcRenderer.send('right_click_msg', {
        type: '提交信息接收', msg: msgObj,
      })
      break;
    case '16':
      if (dataArr[1] == 0) {
        msgObj = {
          title: '撤单提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        }
        logHandler.writeLog(`条件单`, `撤单${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        msgObj = {
          title: '撤单提示',
          message: '撤单成功',
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        }
        logHandler.writeLog(`条件单`, `撤单${dataArr[2]} 成功!`, loginInfo.value.bh)
      }
      ElNotification(msgObj)
      ipcRenderer.send('right_click_msg', {
        type: '提交信息接收', msg: msgObj,
      })
      break;
    case '17':
      if (dataArr[1] == 0) {
        msgObj = {
          title: '平仓提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        }
        logHandler.writeLog(`普通单`, `平仓${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        let bsDirection = dataArr[6] == '1' ? '买' : '卖';
        msgObj = {
          title: '平仓提示',
          message: `<div class="trade-notifica"><div><span>委托数量：${dataArr[4]}</span><span>委托方向：${bsDirection}</span></div><div><span>委托价格：${dataArr[5] == '0' ? '市价' : dataArr[5]}</span></div></div>`,
          dangerouslyUseHTMLString: true,
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        }
        logHandler.writeLog(`普通单`, `平仓成功委托数量：${dataArr[4]} 委托方向：${bsDirection} 委托价格：${dataArr[5] == '0' ? '市价' : dataArr[5]} `, loginInfo.value.bh)
      }
      ElNotification(msgObj)
      ipcRenderer.send('right_click_msg', {
        type: '提交信息接收', msg: msgObj,
      })
      break;
    case '18':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '损盈提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`损盈单`, `损盈操作 ${dataArr[2]} !`, loginInfo.value.bh)
      }
      if (dataArr[1] == 1) {
        ElNotification({
          title: '损盈提示',
          message: `损盈设置成功`,
          dangerouslyUseHTMLString: true,
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`损盈单`, `损盈操作${dataArr[2]} 设置成功!`, loginInfo.value.bh)
        if (dataArr[3]) {
          let obj = {}
          obj['持仓ID'] = dataArr[2]
          obj['止盈止损ID'] = dataArr[3]
          obj['合约ID'] = dataArr[4]
          obj['方向'] = dataArr[5]
          obj['数量'] = dataArr[6]
          obj['止盈价位'] = dataArr[7]
          obj['止损价位'] = dataArr[8]
          obj['止盈金额'] = dataArr[9]
          obj['止损金额'] = dataArr[10]
          obj['止盈止损类别'] = dataArr[11]
          sunyingList.value[dataArr[3]] = { ...obj }
        }
        chicangActive.value = null
        singleTableRef.value?.setCurrentRow()
        chicangHuizongRef.value?.setCurrentRow()
      }
      break;
    case '19':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '损盈提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`损盈单`, `损盈操作 ${dataArr[2]} !`, loginInfo.value.bh)
      }
      if (dataArr[1] == 1) {
        ElNotification({
          title: '损盈提示',
          message: `删除成功`,
          dangerouslyUseHTMLString: true,
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        sunyingList.value = {}
        publish(`23;`);
        publish(`35;0;0;`);
        publish(`38;0;`)
        logHandler.writeLog(`损盈单`, `删除损盈${dataArr[2]} 成功!`, loginInfo.value.bh)
        chicangActive.value = null
        singleTableRef.value?.setCurrentRow()
        chicangHuizongRef.value?.setCurrentRow()
      }
      break;
    case '20':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '获取合约',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      } if (dataArr[1] == 1 && dataArr[2] != 0) {
        let obj = {
          '合约ID': dataArr[2],
          '合约代号': dataArr[3],
          '名称': dataArr[4],
          '市场名称': dataArr[5],
          '客户端合约乘数': dataArr[6],
          '建仓手续费': dataArr[7],
          '平昨手续费': dataArr[8],
          '平今手续费': dataArr[9],
          '币种': dataArr[10],
          '最小波动': dataArr[11],
          '单位': dataArr[12],
          '风险金': dataArr[13],
          '隔夜权益金': dataArr[14],
          '客户端显示币种': dataArr[15],
          '建仓保证金': dataArr[16],
          '合约乘数': dataArr[17],
        }
        heyueData.value.push(obj)
        hyData.value[dataArr[2]] = obj
      }
      if (dataArr[1] == 1 && dataArr[2] == 0) {
        heyuTable.value = heyueData.value.filter(item => {
          let res = storeMain.heyueinfo.some(it => it.heyue_bh == item['合约代号'])
          if (res) return item
          return false
        })
      }
      break;
    case '23':
      if (dataArr[1] == 1 && dataArr[2] != 0 || dataArr[1] == 2 && dataArr[2] != 0) {
        let obj = {
          'ID': dataArr[2],
          '合约名称': dataArr[3],
          '买卖': dataArr[4],
          '持仓量': dataArr[5],
          '可平量': dataArr[6],
          '持仓均价': dataArr[7],
          '币种': dataArr[8],
          '手续费': dataArr[9],
          '合约ID': dataArr[10],
        }
        chicangList.value[dataArr[2]] = obj
      }
      if (dataArr[1] == 3) {
        delete chicangList.value[dataArr[2]];
        publish(`23;`);
      }
      if (dataArr[1] == 4) {
        let obj = { ...chicangList.value[dataArr[2]] }
        obj['合约名称'] = dataArr[3] || obj['合约名称']
        obj['买卖'] = dataArr[4] || obj['买卖']
        obj['持仓量'] = dataArr[5] || obj['持仓量']
        obj['可平量'] = dataArr[6] || obj['可平量']
        obj['持仓均价'] = dataArr[7] || obj['持仓均价']
        obj['币种'] = dataArr[8] || obj['币种']
        obj['手续费'] = dataArr[9] || obj['手续费']
        obj['合约ID'] = dataArr[10] || obj['合约ID']
        chicangList.value[dataArr[2]] = obj
      }
      sunyingList.value = {}
      publish(`35;0;0;`);
      publish(`38;0;`)
      publish(`38;${dataArr[2]};`)
      chicangActive.value = null
      singleTableRef.value?.setCurrentRow()
      chicangHuizongRef.value?.setCurrentRow()
      break;
    case '24':
      if (dataArr[1] == 1 && dataArr[2] != 0 || dataArr[1] == 2 && dataArr[2] != 0) {
        weituoList.value.push({
          '报单编号': dataArr[3],
          '合约名称': dataArr[4],
          '买卖方向': dataArr[5],
          '开平': dataArr[6],
          '状态': dataArr[7],
          '报单价格': dataArr[8],
          '报单手数': dataArr[9],
          '未成交手数': dataArr[10],
          '成交均价': dataArr[11],
          '报单时间': dataArr[12],
          '平仓挂单标志位': dataArr[13],
          '详细描述': dataArr[14],
          '最后成交时间': dataArr[15],
          '开平仓类别': dataArr[16],
          '币种': dataArr[17],
        })
      }
      if (dataArr[1] == 3) {
        let arr = weituoList.value.filter(item => item['报单编号'] != dataArr[2])
        weituoList.value = arr
      }
      if (dataArr[1] == 4) {
        let arr = weituoList.value.map(item => {
          if (item['报单编号'] == dataArr[2]) {
            item['合约名称'] = dataArr[4] || item['合约名称']
            item['买卖方向'] = dataArr[5] || item['买卖方向']
            item['开平'] = dataArr[6] || item['开平']
            item['状态'] = dataArr[7] || item['状态']
            item['报单价格'] = dataArr[8] || item['报单价格']
            item['报单手数'] = dataArr[9] || item['报单手数']
            item['未成交手数'] = dataArr[10] || item['未成交手数']
            item['成交均价'] = dataArr[11] || item['成交均价']
            item['报单时间'] = dataArr[12] || item['报单时间']
            item['平仓挂单标志位'] = dataArr[13] || item['平仓挂单标志位']
            item['详细描述'] = dataArr[14] || item['详细描述']
            item['最后成交时间'] = dataArr[15] || item['最后成交时间']
            item['开平仓类别'] = dataArr[16] || item['开平仓类别']
            item['币种'] = dataArr[17] || item['币种']
          }
          return item
        })
        weituoList.value = arr
      }
      weituoList.value.sort((a, b) => b['报单时间'] - a['报单时间']);
      tiaoJianList.value = weituoList.value.filter(item => item['状态'] == '未成交还在队列中')
      break;
    case '25':
      if (dataArr[1] == 1 && dataArr[2] != 0 || dataArr[1] == 2 && dataArr[2] != 0) {
        chengjiaoList.value.push({
          'ID': dataArr[2],
          '合约名称': dataArr[3],
          '买卖方向': dataArr[4],
          '开平': dataArr[5],
          '成交均价': dataArr[6],
          '成交手数': dataArr[7],
          '成交时间': dataArr[8],
          '成交编号': dataArr[9],
          '建仓均价': dataArr[10],
          '盈亏': dataArr[11],
          '报单编号': dataArr[12],
          '币种': dataArr[13],
          '昨今标志': dataArr[14],
          '手续费': dataArr[15],
          '红包': dataArr[16],
        })
      }
      if (dataArr[1] == 3) {
        let arr = chengjiaoList.value.filter(item => item['ID'] != dataArr[2])
        chengjiaoList.value = arr
      }
      if (dataArr[1] == 4) {
        let arr = chengjiaoList.value.map(item => {
          if (item['ID'] == dataArr[2]) {
            item['合约名称'] = dataArr[3] || item['合约名称']
            item['买卖方向'] = dataArr[4] || item['买卖方向']
            item['开平'] = dataArr[5] || item['开平']
            item['成交均价'] = dataArr[6] || item['成交均价']
            item['成交手数'] = dataArr[7] || item['成交手数']
            item['成交时间'] = dataArr[8] || item['成交时间']
            item['成交编号'] = dataArr[9] || item['成交编号']
            item['建仓均价'] = dataArr[10] || item['建仓均价']
            item['盈亏'] = dataArr[11] || item['盈亏']
            item['报单编号'] = dataArr[12] || item['报单编号']
            item['币种'] = dataArr[13] || item['币种']
            item['昨今标志'] = dataArr[14] || item['昨今标志']
            item['手续费'] = dataArr[15] || item['手续费']
            item['红包'] = dataArr[16] || item['红包']
          }
          return item
        })
        chengjiaoList.value = arr
      }
      chengjiaoList.value.sort((a, b) => b['成交时间'] - a['成交时间']);
      break;
    case '26':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '排行榜接收',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0) {
        paiHangBangListZong.value.push({
          '排行榜类别': dataArr[2],
          '排行期间': dataArr[3],
          '币种': dataArr[4],
          '顺序': dataArr[5],
          '用户ID': dataArr[6],
          '用户名': dataArr[7],
          '盈亏': dataArr[8],
          '在线状态': dataArr[9]
        })
      }
      break;
    case '27':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '跟单提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`跟单`, `跟单${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        if (dataArr[2] == 1) {
          ElNotification({
            title: '跟单提示',
            message: '跟单操作成功',
            type: 'success',
            position: 'bottom-right',
            duration: 1000, offset: 10,
          })
          logHandler.writeLog(`跟单`, `跟单${dataArr[3]} 成功!`, loginInfo.value.bh)
          gendanList.value.push({
            '跟单ID号': dataArr[3],
            '用户ID': dataArr[4],
            '用户名': dataArr[5],
            '合约ID': dataArr[6],
            '操作类别': dataArr[7],
            '数量': dataArr[8],
            '跟单类别': dataArr[9],
            '超价倍数': dataArr[10],
            '数量类别': dataArr[11],
          })
        } else if (dataArr[2] == 2) {
          let arr = gendanList.value.map(item => {
            if (item['跟单ID号'] == dataArr[3]) {
              item['用户ID'] = dataArr[4] || item['用户ID']
              item['用户名'] = dataArr[5] || item['用户名']
              item['合约ID'] = dataArr[6] || item['合约ID']
              item['操作类别'] = dataArr[7] || item['操作类别']
              item['数量'] = dataArr[8] || item['数量']
              item['跟单类别'] = dataArr[9] || item['跟单类别']
              item['超价倍数'] = dataArr[10] || item['超价倍数']
              item['数量类别'] = dataArr[11] || item['数量类别']
            }
            return item
          })
          gendanList.value = arr
        } else if (dataArr[2] == 3) {
          ElNotification({
            title: '跟单提示',
            message: '跟单取消后，请注意自行平仓',
            position: 'bottom-right',
            duration: 1000, offset: 10,
          })
          logHandler.writeLog(`跟单`, `${dataArr[3]} 跟单取消!`, loginInfo.value.bh)
          let arr = gendanList.value.filter(item => item['跟单ID号'] != dataArr[3])
          gendanList.value = arr
        }
      }
      break;
    case '28':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '跟单提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0 && dataArr[3]) {
        gendanList.value.push({
          '跟单ID号': dataArr[2],
          '用户ID': dataArr[3],
          '用户名': dataArr[4],
          '合约ID': dataArr[5],
          '操作类别': dataArr[6],
          '数量': dataArr[7],
          '跟单类别': dataArr[8],
          '超价倍数': dataArr[9],
          '数量类别': dataArr[10],
        })
      }
      break;
    case '29':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '平仓提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `平仓${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        ElNotification({
          title: '平仓提示',
          message: '平仓成功',
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `操作平仓成功!`, loginInfo.value.bh)
      }
      break;
    case '30':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '撤单提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `全部撤单${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        ElNotification({
          title: '撤单提示',
          message: '撤单成功',
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `全部撤单成功!`, loginInfo.value.bh)
      }
      break;
    case '32':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '反手提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `反手${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        let bsDirection = dataArr[6] == '1' ? '买' : '卖';
        ElNotification({
          title: '反手提示',
          message: `<div class="trade-notifica"><div><span>委托数量：${dataArr[4]}</span><span>委托方向：${bsDirection}</span></div><div><span>委托价格：${dataArr[5] == '0' ? '市价' : dataArr[5]}</span></div></div>`,
          dangerouslyUseHTMLString: true,
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `反手成功委托数量：${dataArr[4]} 委托方向：${bsDirection} 委托价格：${dataArr[5] == '0' ? '市价' : dataArr[5]} `, loginInfo.value.bh)
      }
      break;
    case '33':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '货币转换提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        logHandler.writeLog(`操作`, `货币转换${dataArr[2]} !`, loginInfo.value.bh)
      } else {
        ElNotification({
          title: '货币转换提示',
          message: zhuanHuanInfo.value.name1 + '转' + zhuanHuanInfo.value.name2 + '成功！',
          dangerouslyUseHTMLString: true,
          type: 'success',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
        zhuanHuanInfo.value.val2 = dataArr[5]
        logHandler.writeLog(`操作`, `货币${zhuanHuanInfo.value.name1 + '转' + zhuanHuanInfo.value.name2 + '成功！'} !`, loginInfo.value.bh)
      }
      break;
    case '35':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '损盈提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0) {
        logHandler.writeLog(`损盈单`, `损盈操作${dataArr[2]} 设置成功!`, loginInfo.value.bh)
        let obj = {}
        obj['止盈止损ID'] = dataArr[2]
        obj['合约ID'] = dataArr[3]
        obj['方向'] = dataArr[4]
        obj['数量'] = dataArr[5]
        obj['止盈价位'] = dataArr[6]
        obj['止损价位'] = dataArr[7]
        obj['止盈金额'] = dataArr[8]
        obj['止损金额'] = dataArr[9]
        obj['止盈止损类别'] = dataArr[10]
        obj['超价点数'] = dataArr[11]
        sunyingList.value[dataArr[2]] = { ...obj }
        chicangActive.value = null
        singleTableRef.value?.setCurrentRow()
        chicangHuizongRef.value?.setCurrentRow()
      }
      break;
    case '38':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '损盈提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0) {
        let obj = {}
        obj['止盈止损ID'] = dataArr[2]
        obj['合约ID'] = dataArr[3]
        obj['方向'] = dataArr[4]
        obj['数量'] = dataArr[5]
        obj['止盈价位'] = dataArr[6]
        obj['止损价位'] = dataArr[7]
        obj['止盈金额'] = dataArr[8]
        obj['止损金额'] = dataArr[9]
        obj['止盈止损类别'] = dataArr[10]
        obj['持仓ID'] = dataArr[12]
        sunyingList.value[dataArr[2]] = { ...obj }
        chicangActive.value = null
        singleTableRef.value?.setCurrentRow()
        chicangHuizongRef.value?.setCurrentRow()
      }
      break;
    case '41':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '历史委托错误',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0) {
        historyTradingList.value.weituo.push({
          '报单编号': dataArr[2],
          '合约名称': dataArr[3],
          '币种': dataArr[4],
          '买卖方向': dataArr[5],
          '开平标志': dataArr[6],
          '报单状态': dataArr[7],
          '报单价格': dataArr[8],
          '报单数量': dataArr[9],
          '成交数量': dataArr[10],
          '成交均价': dataArr[11],
          '报单时间': dataArr[12],
          '委托类型': dataArr[13],
        })
      }
      break;
    case '42':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '历史成交错误',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0) {
        historyTradingList.value.chengjiao.push({
          '成交编号': dataArr[2],
          '合约名称': dataArr[3],
          '币种': dataArr[4],
          '买卖方向': dataArr[5],
          '开平标志': dataArr[6],
          '成交价格': dataArr[7],
          '成交数量': dataArr[8],
          '手续费': dataArr[9],
          '成交时间戳': dataArr[10],
          '报单编号': dataArr[11],
        })
      }
      break;
    case '43':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '历史平仓错误',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1 && dataArr[2] != 0) {
        historyTradingList.value.pingcang.push({
          '平仓ID': dataArr[2],
          '合约名称': dataArr[3],
          '币种': dataArr[4],
          '买卖方向': dataArr[5],
          '开仓均价': dataArr[6],
          '平仓价格': dataArr[7],
          '平仓手数': dataArr[8],
          '平仓盈亏': dataArr[9],
          '平仓时间戳': dataArr[10],
          '平仓成交号': dataArr[11],
        })
      }
      break;
    case '45':
      if (dataArr[1] == 0) {
        ElNotification({
          title: '错误提示',
          message: dataArr[2],
          type: 'error',
          position: 'bottom-right',
          duration: 1000, offset: 10,
        })
      }
      if (dataArr[1] == 1) {
        if (dataArr[2] == 0 && isopenCkickZiJinLiuShui.value) {
          ipcRenderer.send('oepn-zijinLiushui', JSON.stringify({ bh: loginInfo.value.bh, token: loginInfo.value.token, ischurujinRefresh: ischurujinRefresh.value, dataArr: zijinliushui.value, zijin: zijinObj[bizhong.value], loginInfo: loginInfo.value, huilvdetailInfo: huilvdetailInfo.value }))
          ischurujinRefresh.value = false
          isopenCkickZiJinLiuShui.value = false
        } else {
          zijinliushui.value.push(dataArr)
        }
      }
      break;

    default:
      break;
  }
};

const setHagnqingData = (event) => {
  let Arr = event.split(";");
  let heyueinfo = Object.values(storeMain.classHeyue['期货']);
  if (Arr[0] == 2 && heyueinfo) {
    let [
      ,
      contractCode,
      updateTime,
      updateMilli,
      seller1,
      sellingVol1,
      currentPrice,
      buy1,
      buyVol1,
      dailyLimit,
      downLimit,
      volume,
      inventory,
      openingToday,
      closingToday,
      highestPrice,
      lowestPrice,
      averageDaily,
      closedYes,
      holdingsYes,
      transaction,
      settlementYes,
    ] = Arr;
    conditionSingleTrigger({ price: currentPrice, heyue_bh: contractCode })
    getShangpinInfo(1);
    if (!hagnqingData.value) {
      hagnqingData.value = {};
      hqdata.value = {};
      heyueinfo.forEach((item) => {
        // if (item.jiekou_id == 2) {
        hagnqingData.value[item.heyue_bh] = item;
        hqdata.value[item.heyue_id] = item;
        // }
      });
      return;
    }
    // let xianshou = inventory
    //   ? hagnqingData.value[contractCode]?.inventory
    //     ? inventory - hagnqingData.value[contractCode]?.inventory > 0
    //       ? inventory - hagnqingData.value[contractCode]?.inventory
    //       : 1
    //     : 1
    //   : "----";
    hagnqingData.value[contractCode] = {
      ...hagnqingData.value[contractCode],
      ...{
        nowUpw: upsAndDowns(currentPrice, settlementYes), // 当前涨跌
        nowGain: figureRange(currentPrice, settlementYes), // 当前涨幅
        contractCode, // 期货合约代号
        timestamp: updateTime * 1, // 更新时间戳
        updateTime: parseTime(updateTime, "{hh}:{ii}:{ss}"), // 更新时间
        updateMilli, // 更新毫秒
        seller1: seller1 * 1, // 卖1
        sellingVol1: sellingVol1 * 1, // 卖1量
        currentPrice: currentPrice * 1, // 现价
        buy1: buy1 * 1, // 买1
        buyVol1: buyVol1 * 1, // 买1量
        dailyLimit: dailyLimit * 1, // 涨停板价
        downLimit: downLimit * 1, // 跌停板价
        volume: volume * 1, // 成交量
        inventory: inventory * 1, // 矜持长
        openingToday: openingToday * 1, // 今开盘
        closingToday: closingToday * 1, // 今收盘
        highestPrice: highestPrice * 1, // 最高价
        lowestPrice: lowestPrice * 1, // 最低价
        averageDaily: averageDaily * 1, // 当日均价
        closedYes: closedYes * 1, // 昨收盘
        holdingsYes: holdingsYes * 1, // 昨持仓量
        transaction: transaction * 1, // 现价
        settlementYes: settlementYes * 1, // 昨日结算价格
        rizeng: jsrizeng(inventory, holdingsYes), // 日增
        xianshou: transaction,
        flicker: true,
      },
    };
    hqdata.value[hagnqingData.value[contractCode].heyue_id] =
      hagnqingData.value[contractCode];
  }
};

const getGOngGaoInfo = async () => {
  let { data } = await axios.post(storeMain.xianlu.url + "/article", {
    cate_id: 10,
  });
  if (data.code == 0) {
    gongGaoList.value = data.data.map((item) => {
      return item;
    });
  } else {
    ElMessage({ message: data.msg, type: "error" });
  }
};
const openGOngGaoInfo = (v) => {
  ipcRenderer.send("open-gonggaoinfo", JSON.stringify(v));
};

// const openHeyueListTap = () => {
//     ipcRenderer.send('oepnHeyueList')
// }
const switchList = (v) => {
  activeList.value = v;
  if (v == "排行榜") {
    paiHangBangListZong.value = [];
    publish(`26;`);
  }
  if (v == "公告表") {
    getGOngGaoInfo();
  }
};
const switchlishiList = (v) => {
  activelishiList.value = v;
  let str = "";
  const unixTime = moment(historyTrading.value.time).unix(),
    unixtimeEnd = moment(historyTrading.value.timeEnd).unix()
  if (v == "历史委托") {
    historyTradingList.value.weituo = [];
    str = `41`;
  }
  if (v == "历史成交") {
    historyTradingList.value.chengjiao = [];
    str = `42`;
  }
  if (v == "历史平仓") {
    historyTradingList.value.pingcang = [];
    str = "43";
  }
  publish(
    `${str};${loginInfo.value.uid};${unixTime};${unixtimeEnd};${historyTrading.value.huobiId}; `
  );
};

const getPrice = (type) => {
  let price = "";
  if (showkuaijiejia.value) {
    switch (kuaijiejia.value) {
      case "对手价":
        price =
          type == 1 ? shangpinInfo.value.seller1 : shangpinInfo.value.buy1;
        price = price || "0.00";
        break;
      case "市价":
        price = "市价";
        break;
      case "最新价":
        price = shangpinInfo.value.currentPrice || "0.00";
        break;
    }
  } else {
    price = shangpinInfo.value.xiadanPrice || "0.00";
  }
  return price;
};

function openSunYing() {
  if (!shangpinInfo.value.heyue_id) {
    return ElMessage({ message: "请选择合约", type: 'error' });
  }
  ipcRenderer.send("open-stopLossOpen", JSON.stringify(shangpinInfo.value));
}
function maxNum(money) {
  isMaxNumShow.value =
    shangpinInfo.value.heyue_bh && heyueData.value.length > 0;
  if (!money) {
    return 0;
  }
  if (!shangpinInfo.value.heyue_bh) {
    return 0;
  }
  if (heyueData.value.length <= 0) {
    return 0;
  }
  let obj = heyueData.value.find(
    (item) => item["合约代号"] == shangpinInfo.value.heyue_bh
  );
  let price = money / obj["建仓保证金"];
  price = Math.floor(price);
  MaxNumVal.value = price;
  return price;
}
const suoPriceTap = (v) => {
  suoPrice.value = v;
};
const changeLeftTap = () => {
  isShowLeft.value = !isShowLeft.value;
};
const selectMuluTap = (v) => {
  selectMulu.value = v;
  if (v != -1 && v != 2) {
    showRight.value = v;
  }
  if (v == 12) {
    paiHangBangListZong.value = [];
    publish(`26;`);
    activeList.value = "排行榜";
  }
  if (v == 114) {
    switchlishiList("历史委托");
  }
  getHeYueYingSun()
};

const minWin = () => {
  ipcRenderer.send("minplaceAnOrder");
};

function jsrizeng(inventory, holdingsYes) {
  if (inventory && holdingsYes) {
    return inventory - holdingsYes;
  }
  return "---";
}
function upsAndDowns(nowp, yesp) {
  let difference = parseFloat(nowp - yesp) * 1;
  if (isNaN(difference)) {
    return "---";
  }
  let f = difference.toFixed(5);
  return f;
}

function figureRange(n, y) {
  let difference = parseFloat(n) - parseFloat(y);
  if (isNaN(difference)) {
    return "---";
  }
  let business = difference / y;
  if (isNaN(business)) {
    return "---";
  }
  let r = (business * 100).toFixed(2);
  return r;
}
function parseTime(time, cFormat) {
  if (arguments.length == 0) {
    return null;
  }
  const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
  let date;
  if (typeof time == "object") {
    date = time;
  } else {
    if (typeof time == "string" && /^[0-9]+$/.test(time)) {
      time = parseInt(time);
    }
    if (typeof time == "number" && time.toString().length == 10) {
      time = time * 1000;
    }
    date = new Date(time);
  }
  const formatObj = {
    y: date.getFullYear(),
    m: date.getMonth() + 1,
    d: date.getDate(),
    h: date.getHours(),
    i: date.getMinutes(),
    s: date.getSeconds(),
    a: date.getDay(),
  };
  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
    let value = formatObj[key];
    if (key == "a") {
      return ["日", "一", "二", "三", "四", "五", "六"][value];
    }
    if (result.length > 0 && value < 10) {
      value = "0" + value;
    }
    return value || 0;
  });
  return time_str;
}
// const heardinputZhuanhuan = () => {
//   if (zhuanHuanInfo.value.val1 <= 0) {
//     zhuanHuanInfo.value.val1 = 0;
//   }
// };

// const huobiZuanHuan = () => {
//   let name = zhuanHuanInfo.value.name1;
//   zhuanHuanInfo.value.name1 = zhuanHuanInfo.value.name2;
//   zhuanHuanInfo.value.name2 = name;
// };
// const huobiZuanHuanSumbit = throttle(function () {
//   let ID1 = zhuanHuanInfo.value.name1 == "美元" ? 3 : 1,
//     ID2 = zhuanHuanInfo.value.name2 == "美元" ? 3 : 1;
//   publish(`33;${ID1};${ID2};${zhuanHuanInfo.value.val1};${clientId.value}`);
// }, 1000);
//传统下单参数
// const traditionalOrder=ref({
//     direction:1,//1买2卖
//     price:0,//价格
//     amount:0,//数量

// })
</script>

<style scoped lang="less">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "serif";
  user-select: none;
  position: relative;
  color: #000000;
}

body {
  font-size: 0;
  color: #f0f0f0;
  height: 300px;
  cursor: default;
}

#xia_app {
  // height: 345px;
  background-color: #f0f0f0;
}

.tab_bar {
  font-size: 14px;
  background-color: #d5d8e6;
  color: #000000;
  display: flex;
  align-items: center;
  line-height: 30px;
  justify-content: space-between;
  height: 30px;
  -webkit-app-region: drag;
}

.tab_bar_left {
  font-size: 13px;
  padding: 0 5px;
}

.tab_bar_left span {
  margin-left: 10px;
}

.tab_bar_right {
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
}

.tab_bar_right i {
  font-size: 18px;
  padding: 0 7px;
}

.icon-shezhi:hover {
  background-color: #317dc2;
  color: #fff;
}

.icon-a-tubiaozhediexiangxia:hover {
  background-color: #e81122;
  color: #fff;
}

.xiad_body {
  background-color: #f0f0f0;
  font-size: 12px;
  padding: 6px;
  display: flex;
  height: 310px;
}

.xiad_body_left {
  background-color: #ffffff;
  border: 2px solid #afb3b8;
  padding: 0 8px;
  width: 129px;
  height: 100%;
}

.yiji_firsrt {
  position: relative;
}

.yiji_firsrt::after {
  content: "";
  position: absolute;
  border-left: 1px dotted #9b9b9b;
  height: calc(100% - 15px);
  top: 15px;
  left: 5px;
}

.yiji_title {
  display: flex;
  align-items: center;
}

.yiji_zhedie {
  border: 1px solid #9b9b9b;
  background-color: #fafbfb;
  border-radius: 2px;
  width: 10px;
  height: 10px;
  line-height: 7px;
  text-align: center;
}

.jibie_item {
  padding-left: 8px;
  position: relative;
}

.jibie_item::after {
  content: "";
  position: absolute;
  border-bottom: 1px dotted #9b9b9b;
  width: 4px;
  height: 1px;
  top: 7px;
  left: 2px;
}

.yiji_childer {
  margin-left: 25px;
}

.erji_title::before {
  content: "";
  position: absolute;
  border-left: 1px dotted #9b9b9b;
  height: 100%;
  top: 0;
  left: 1px;
}

.erji_title:last-of-type::before {
  height: 50%;
}

.body_yiji .active {
  background-color: #0078d7;
  color: #fff;
}

.left_zhedie_btn {
  height: 60px;
  line-height: 60px;
}

.left_zhedie_btn:hover {
  box-shadow: 1px 1px 1px 1px #999;
}

.left_zhedie_btn .iconfonMy {
  display: inline-block;
  transform: rotate(90deg);
}

.left_zhedie_btn .icon {
  display: inline-block;
  transform: rotate(-90deg);
}

.body_right,
.body_right2,
.body_right3,
.body_right4,
.body_right6,
.body_right7,
.body_right8 {
  height: 100%;
  padding: 6px 0;
  display: flex;
}

.paiahng_bang {
  box-shadow: 0 0 1px 1px #dddddd;
  width: 375px;
  height: 100%;
  font-size: 12px;

  .item_list {
    display: flex;
    align-items: center;
    padding-top: 10px;

    >span {
      width: 70px;
      padding: 0 8px;
      text-align: justify;
      text-align-last: justify;
    }

    input {
      height: 22px;
      font-size: 12px;
      width: 150px;
    }

    div {
      display: flex;
      align-items: center;
    }

    select {
      font-size: 12px;
      width: 150px;
    }

    .g_radio {
      margin-right: 10px;

      input {
        width: 16px;
      }
    }
  }

  .gen_btn {
    padding-top: 20px;
    padding-left: 70px;

    span {
      border-radius: 3px;
      display: inline-block;
      height: 25px;
      line-height: 25px;
      background-color: #2d8cf0;
      color: #fff;
      width: 100px;
      text-align: center;
    }
  }
}

.body_right_left_top {
  box-shadow: 0 0 1px 1px #dddddd;
  padding: 0 10px;
  width: 359px;
  height: 175px;
}

.body_right_left_title {
  display: flex;
  align-items: center;
  position: relative;
}

.body_right_left_title .hexue {
  width: 95px;
}

.body_right_left_title .s_cont {
  height: 20px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  position: relative;
}

.body_right_left_title .s_cont select {
  font-size: 13px;
  font-family: "Ebrima";
  height: 20px;
  width: 95px;
}

.body_right_left_title .icon-zhuanhuan {
  width: 30px;
  text-align: center;
}

.body_right_left_title .hexue input {
  font-weight: bold;
  width: 110px;
}

.body_right_left_title .shoushu input {
  font-weight: bold;
  width: 60px;
}

.body_right_left_title .jiage {
  margin-left: 5px;
}

.body_right_left_title .jiage input {
  font-weight: bold;
  width: 75px;
}

.hexue .sou_suo:hover {
  box-shadow: 1px 1px 1px 1px #999;
}

.heyue_ianhao {
  padding-top: 20px;
  line-height: 25px;
  padding-left: 3px;
}

.max_min_price {
  position: absolute;
  top: 5px;
  right: 0;
  line-height: 25px;
}

.s_price {
  background-color: #f0f0f0;
  position: absolute;
  left: 1px;
  bottom: 0;
  height: 19px;
  width: 58px;
  z-index: 10;
}

.jiage_caozuo {
  position: absolute;
  background-color: #f0f0f0;
  box-shadow: 1px 1px 1px 1px #a0a0a0;
  top: 5px;
  left: 40px;
  width: 150px;
  padding: 5px;
  z-index: 50;
  text-align: center;
}

.jiage_caozuo span {
  border-radius: 2px;
  display: inline-block;
  width: 40px;
  background-color: #fdfdfd;
  border: 1px solid #d0d0d0;
  text-align: center;
  margin: 2px;
  line-height: 20px;
}

.jiage_s_cont:active {
  box-shadow: 1px 1px 1px 1px #999;
}

.body_right_left_mp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;

  >div {
    background-color: #d7e3f1;
  }
}

.mp_item {
  border: 1px solid #72a6d9;
  border-radius: 3px;
  flex: 1;
  margin: 0 5px;
  text-align: center;
  padding: 0 5px;
}

.mp_item:hover {
  border-color: #f00000;
}

.mp_item:nth-child(2):hover {
  border-color: #009600;
}

.mp_item:nth-child(3):hover {
  border-color: #000096;
}

.mp_item div:nth-child(1) {
  border-bottom: 1px solid #94968b;
  line-height: 25px;
}

.mp_item div:nth-child(2) {
  font-size: 16px;
  line-height: 30px;
}

.max_num {
  background-color: #f0f0f0 !important;
  position: absolute;
  left: 15px;
  bottom: -7px;
  display: flex;

  span {
    background-color: #f0f0f0;
    width: 100px;
    margin-right: 10px;
    text-align: center;
  }
}

.red {
  color: #f00000;
}

.green {
  color: #009600;
}

.blue {
  color: #000096;
}

.body_right_left_btn {
  text-align: right;
  padding: 10px;
}

.body_right_left_btn span,
.body_right_right_btn span {
  display: inline-block;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  background: #fdfdfd;
  line-height: 20px;
  width: 60px;
  text-align: center;
  margin-right: 5px;
}

.body_right_left_btn span:hover,
.body_right_right_btn span:hover {
  background-color: #e0eef9;
  border-color: #0078d4;
}

.he_yue_info {
  position: absolute;
  bottom: -23px;
}

.body_right_left_center .introduce {
  height: 30px;
  line-height: 30px;
  padding: 0 5px;
}

.body_right_left_center .inp_frame {
  border: 1px solid #fefefe;
  border-bottom: none;
  box-shadow: 0px 1px 2px -1px #838383;
  height: 65px;
  padding: 6px;
}

.body_right_left_buttom {
  position: relative;
}

.body_right_left_buttom span {
  color: #0000ff;
  font-size: 12px;
  padding: 0 5px;
  line-height: 30px;
  border: 2px solid transparent;
}

.body_right_left_buttom span:hover {
  border-color: #fff;
}

.body_right_left_buttom .icon-a-tubiaozhediexiangxia {
  position: absolute;
  right: 0;
  transform: rotate(-90deg);
  width: 30px;
  height: 30px;
  text-align: center;
}

.body_right_right {
  // padding-left: 6px;
  // width: 753px;
  width: 100%;

  .saixuan_paihang {
    display: flex;
    align-items: center;
    padding: 5px 0;

    select {
      margin-right: 10px;
      font-size: 12px;
      height: 22px;
      width: 115px;
    }

    div {
      display: flex;
      align-items: center;
    }
  }
}

.body_right_right_table {
  display: flex;
  align-items: center;

  span {
    // flex: 1;
    white-space: nowrap;
  }

  input {
    font-size: 12px;
    height: 20px;
  }

  select {
    font-size: 12px;
    height: 18px;
  }
}

.body_right_zijin {
  padding-left: 2px;

  .zijin_biao {
    box-shadow: 0 0 1px 1px #a1a6af;
    height: 253px;
    line-height: 20px;
    background-color: #f1f8ff;
    position: relative;

    .li {
      display: flex;
      padding-right: 140px;

      .left,
      .right {
        flex: 1;
        display: flex;
        justify-content: space-between;
        padding: 0 50px 0 5px;
      }
    }

    .li:nth-of-type(2n + 2) {
      background-color: #dde4eb;
    }

    .zijinzhuanhuan {
      position: absolute;
      bottom: 0;
      width: 100%;
      left: 0;
      padding: 20px 10px;
      display: flex;
      align-items: center;

      div {
        display: flex;
        align-items: center;

        span,
        input {
          margin-right: 10px;
        }

        input,
        .jieguo {
          width: 80px;
        }

        .jieguo {
          background-color: #f0f0f0;
          border-radius: 2px;
          border: 1px solid #4f4f4f;
          color: #666;
        }
      }

      .iconfonMy {
        margin-right: 10px;
        color: #000;
      }

      .btn {
        border: 1px solid #d0d0d0;
        border-radius: 3px;
        background: #fdfdfd;
        line-height: 20px;
        width: 60px;
        text-align: center;
        margin-right: 10px;
      }
    }
  }
}

.body_right_right_table span {
  background-color: #e6e6e6;
  padding: 0 8px;
  border-right: 1px solid #acacac;
}

.body_right_right_table .active {
  background-color: #ffffff;
}

:deep(.el-table th.el-table__cell > .cell),
:deep(.el-table td.el-table__cell div) {
  padding: 0;
  padding-right: 3px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

:deep(.el-table th.el-table__cell.is-leaf),
:deep(.el-table--enable-row-transition .el-table__body td.el-table__cell) {
  padding: 0;
  color: #000000;
  font-weight: normal;
}

:deep(.el-table th.el-table__cell.is-leaf) {
  background-color: #f0f0f0;
  border-color: #aaaaaa;
}

:deep(.el-table--enable-row-transition .el-table__body td.el-table__cell) {
  background-color: #f1f8ff;
  border-color: #f0f0f0;
}

:deep(.el-table--enable-row-transition .el-table__body td.el-table__cell .cell) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

:deep(.el-scrollbar__bar) {
  display: block !important;
  opacity: 1;
}

:deep(.el-scrollbar__bar.is-horizontal>div) {
  background: #dedfe1;
  opacity: 1;
}

:deep(.el-scrollbar__bar.is-horizontal) {
  height: 5px;
  opacity: 1;
}

:deep(.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar) {
  width: 5px;
  height: 5px;
}

:deep(.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar-thumb) {
  background: #dedfe1;
  border-radius: 5px;
  opacity: 1;
}

:deep(.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar-thumb:hover) {
  background: #dedfe1;
  opacity: 1;
}

:deep(.current-row .cell) {
  background-color: #9ecee7;
}

:deep(.el-table--border .el-table__cell) {
  background-color: #f1f8ff;
  padding: 0;
}

:deep(.selected-row td.el-table__cell) {
  background-color: #9ecee7 !important;
}

.wei_tuo_che,
.qu_xiao_gen_dan {
  color: #0078d7;
}

.body_right_right_btn {
  border-bottom: 1px solid #cfcfcf;
  box-shadow: 0 1px 1px -6px #cfcfcf;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 5px 0;
  margin-right: 5px;
}

.body_right_left_top2 {
  height: 188px;
}

.body_right_left_center .inp_frame2 {
  height: 55px;
}

.body_right_left_title2 {
  display: block;
}

.right_left_title_item {
  display: flex;
  align-items: center;
  padding-top: 5px;
}

.right_left_title_item .title {
  width: 31px;
  padding-right: 7px;
  text-align: right;
}

.mai_mai_btn,
.PING_C {
  background-color: #d7e3f1;
  border: 1px solid #3b7db3;
  border-radius: 2px;
  line-height: 25px;
  height: 25px;
  width: 100px;
  display: flex;
}

.mai_mai_btn span,
.PING_C span {
  flex: 1;
  text-align: center;
}

.mai_mai_btn span:nth-of-type(1),
.PING_C span {
  border-right: 1px solid #3b7db3;
}

.PING_C {
  width: 150px;
}

.PING_C span:nth-last-of-type(1) {
  border: none;
}

.mai_mai_btn .active,
.PING_C .active {
  background-color: #448ac5;
  color: #fff;
}

.bao_zhi {
  display: flex;
  align-items: center;
  padding-left: 5px;
}

.bao_zhi label {
  padding-left: 2px;
}

.shou_shu {
  position: relative;
  font-weight: bold;
}

.shou_shu input,
.jaige_input input {
  width: 75px;
  font-weight: bold;
}

.shou_shu input::-webkit-inner-spin-button,
.shou_shu input::-webkit-outer-spin-button,
.jaige_input input::-webkit-inner-spin-button,
.jaige_input input::-webkit-outer-spin-button,
.right3_left_div input::-webkit-inner-spin-button,
.right3_left_div input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.jia_jian {
  display: inline-block;
  border: 1px solid #9ba6b4;
  background-color: #f0f0f0;
  width: 15px;
  text-align: center;
}

.number {
  font-weight: normal;
  margin-left: 10px;
}

.jaige_input input {
  width: 75px;
  font-weight: bold;
}

.open_view_list {
  margin: 0 8px;
  width: 15px;
}

.open_view_list:hover {
  box-shadow: 1px 1px 1px 1px #cfcfcf;
}

.xiadan_btn {
  display: flex;
}

.xiadan_btn span {
  color: #fff;
  background-color: #c74547;
  line-height: 25px;
  border-radius: 3px;
  padding: 0 5px;
}

.xiadan_btn span:nth-of-type(2) {
  background-color: #fdfdfd;
  color: #000;
  margin-left: 10px;
}

.view_list {
  background-color: #f0f0f0;
  position: absolute;
  box-shadow: 1px 1px 1px 1px #737373;
  left: 27px;
  padding: 13px 10px 13px 15px;
  z-index: 10;
}

.view_list span {
  background-color: #fdfdfd;
  border: 1px solid #d1d1d1;
  line-height: 20px;
  width: 70px;
  display: block;
  margin-bottom: 5px;
  padding: 0 5px;
}

.view_list span:nth-last-of-type(1) {
  margin: 0;
}

.zhang_die {
  position: absolute;
  right: 10px;
  bottom: -5px;
}

.zhang_die span {
  display: block;
  line-height: 30px;
}

.z_z {
  color: #f00201;
}

.d_d {
  color: #6fad31;
}

.zhang_die i {
  color: #000;
  font-style: normal;
}

.body_right2_left_top,
.right2_left_bottom {
  border: 2px solid #e2e2e2;
  width: 560px;
  display: flex;
  flex-wrap: wrap;
  padding: 5px;
  height: 130px;
}

.body_right2_left_top>div {
  line-height: 24px;
  display: flex;
  align-items: center;
}

.body_right2_left_top>div input {
  margin-right: 2px;
}

.body_right2_left_top>div {
  width: 50%;
}

.body_right2_left_top .right2_left_top_last_div {
  width: 50% !important;
}

.right2_left_bottom {
  margin-top: 4px;
  height: 115px;
  justify-content: space-between;
}

.right2_left_bottom_div {
  display: flex;
  align-items: center;
  line-height: 24px;
  font-size: 13px;
  padding-right: 10px;
}

.right2_left_bottom_div {
  width: 50%;
}

.right2_left_bottom_div select {
  width: 110px;
  font-size: 12px;
}

.right2_left_bottom_div span {
  width: 135px;
  font-size: 12px;
}

.right2_left_btn {
  margin-top: 7px;
}

.right2_left_btn button,
.right3_left_btn button,
.body_right4_div button,
.body_right6_left_div button {
  border-radius: 4px;
  background-color: #fdfdfd;
  border: 1px solid #d5d5d5;
  padding: 0 20px;
  line-height: 24px;
}

.right2_left_btn button:active {
  border-color: #0078d7;
}

.body_right2_right {
  padding: 4px 20px;
}

.right2_right_select select {
  font-size: 13px;
}

.right2_right_body {
  margin: 8px 0;
  border: 2px solid #e2e2e2;
  height: 217px;
  width: 485px;
  padding: 0 2px;
}

.right2_right_body_div {
  display: flex;
  align-items: center;
  line-height: 21px;
}

.right2_right_body_div select {
  font-size: 12px;
  margin-left: 20px;
  width: 70px;
}

.right2_right_body_div45 span {
  width: 100px;
}

.right2_right_body_div45 select {
  width: 150px;
  font-size: 12px;
}

.body_right3_left {
  border: 1px s;
}

.body_right3_left,
.body_right3_right {
  margin-top: 10px;
  border: 2px solid #e2e2e2;
  width: 370px;
  height: 210px;
  position: relative;
  padding: 10px 0 10px 8px;
}

.body_right3_left_title,
.body_right3_right_title,
.body_right6_title {
  position: absolute;
  background-color: #f0f0f0;
  top: -8px;
  left: 10px;
}

.right3_left_btn {
  padding: 5px 0;
}

.right3_left_div {
  display: flex;
  align-items: center;
  padding: 13px 0;
}

.right3_left_div input {
  width: 38px;
  font-size: 12px;
  margin-left: 3px;
}

#xiadanView {
  width: auto;
}

.baifenhao {
  margin-left: 3px;
}

.right3_left_div_span {
  width: 90px;
}

.right3_left_div_btn {
  border-radius: 2px;
  background-color: #fdfdfd;
  border: 1px solid #d5d5d5;
  padding: 0 5px;
  font-size: 12px;
  line-height: 19px;
}

.right3_left_div_btn:active {
  border-color: #0078d7;
}

.body_right3_right {
  margin-left: 10px;
  width: 355px;
  padding-top: 15px;
  padding-right: 10px;
}

.body_right3_right_div {
  padding-bottom: 10px;
}

.body_right4 {
  display: block;
  padding: 15px;
  width: 320px;
}

.body_right4_div {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.body_right4_div span {
  width: 80px;
}

.body_right4_div input,
.body_right4_div select {
  font-size: 12px;
  width: 90px;
}

.body_right4_div button {
  font-size: 12px;
  width: 170px;
}

.body_right4_cont {
  line-height: 19px;
}

.body_right5_left {
  width: 300px;
  height: 190px;
}

.right5_left_div {
  padding: 5px 0;
}

.right5_left_div input,
.right5_left_div select {
  font-size: 12px;
  width: 50px;
}

.right5_left_div input::-webkit-inner-spin-button,
.right5_left_div input::-webkit-outer-spin-button {
  -webkit-appearance: button;
}

.right5_left_div select {
  width: 120px;
}

.body_right5_right {
  width: 370px;
  height: 190px;
}

.body_right6_cont {
  margin-left: 10px;
  margin-top: 10px;
  border: 2px solid #e2e2e2;
  width: 760px;
  height: 100%;
  position: relative;
  padding: 15px 0 10px 8px;
  display: flex;
}

.body_right6_left {
  width: 310px;
}

.body_right6_left_div {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.body_right6_left_div span {
  margin-right: 10px;
}

.body_right6_left_div select {
  width: 130px;
  font-size: 12px;
}

.body_right6_left_div .sun_jia {
  border: 2px solid #f8f8f8;
  background: #f0f0f0;
  padding: 0 20px 0 3px;
}

.body_right6_left_div button {
  font-size: 12px;
  padding: 0 5px;
}

.body_right6_right {
  flex: 1;
}

.body_right6_right_div {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.body_right6_right_div input {
  margin-right: 2px;
}

.body_right6_right_div select {
  font-size: 12px;
  margin: 0 5px;
  width: 70px;
}

.body_right6_right_div_set_width {
  width: 150px;
}

.body_right6_right_div a {
  color: #3c3ccc;
  text-decoration: none;
  margin-left: 5px;
}

.body_right7_cont {
  width: 890px;
  height: 190px;
}

.body_right7_left {
  width: 440px;
}

.body_right6_left_div_name {
  width: 130px;
}

.body_right7_left select {
  font-size: 12px;
  width: 110px;
}

.body_right7_left input {
  font-size: 12px;
  margin-right: 2px;
}

.body_right7 {
  padding-left: 40px;
}

.body_right8_left {
  border-radius: 2px;
  background-color: #ffffff;
  border: 2px solid #a0a4aa;
  margin: 10px 0;
  width: 235px;
  overflow-y: scroll;
}

.body_right7_left::-webkit-scrollbar {
  width: 4px;
}

.body_right7_left_div {
  display: flex;
  align-items: center;
  line-height: 20px;
  border-bottom: 2px solid #f2f2f2;
}

.pass_word_body {
  display: block;

  .pass_word {
    span {
      display: inline-block;
      padding: 0 5px;
      border-right: 1px solid transparent;
      line-height: 22px;
    }

    .active {
      background-color: #fff;
      border-color: #d5d5d5;
    }
  }

  .input_password {
    >div {
      margin-top: 10px;

      span {
        display: inline-block;
        width: 60px;
        text-align-last: justify;
      }
    }
  }

  .sumbit {
    margin-top: 10px;

    span {
      display: inline-block;
      border: 1px solid #d0d0d0;
      border-radius: 3px;
      background: #fdfdfd;
      line-height: 20px;
      width: 90px;
      letter-spacing: 1px;
      text-align: center;
      margin-left: 114px;
    }
  }
}

.kuai_jie_jian {
  border-right: 2px solid #f2f2f2;
  flex: 2;
  padding: 0 5px;
}

.dong_zuo {
  flex: 3;
  padding: 0 5px;
}

.body_right7_right {
  margin-top: 10px;
  padding-left: 7px;
}

.body_right7_right_div {
  margin-bottom: 7px;
}

.body_right7_right input {
  width: 60px;
  margin-left: 20px;
}

.body_right7_right select {
  width: 40px;
  margin-left: 20px;
}

.body_right8 {
  display: block;
  padding: 30px 10px;
}

.body_right8_div {
  display: flex;
  align-items: center;
  margin-bottom: 7px;
}

.body_right8_div input {
  margin-right: 2px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  /* 始终显示箭头 */
}

/* 针对 Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  /* 让箭头始终显示 */
}

.yuzhi {
  margin: 0 5px;
  width: 70px;
  font-size: 12px;
}
</style>
